Simple Applescript to get folder names, parent folder paths, and folder paths.

Discussion in 'Mac Programming' started by Koby3663, Feb 2, 2011.

  1. Koby3663 macrumors newbie

    Feb 2, 2011
    Hey I just could not find a simple resource to get these three things out of a folder path. This takes the folder and breaks it down to 3 levels the folder name, folder path, and the parent folder path.

    tell application "Finder"
    	set FolderPath to (choose folder) -- sets file path to folder you select
    	set ParentFolder to container of FolderPath -- sets the parent folder of the folder you select
    	set Foldername to name of folder FolderPath -- sets the folder name as text
    	display dialog FolderPath as text
    	display dialog ParentFolder as text
    	display dialog Foldername as text
    end tell
  2. MediaGeek macrumors newbie

    Feb 17, 2011
    Thanks for this

    I know you posted this awhile ago, but thanks for putting it up. It was a simple thing that was hanging me up as well.

Share This Page