[n00b]: How to get names of folders into a list

Hi all,

I have very little experience with Applescript and am currently trying to learn/teach myself it. I have started a project which is perhaps a little ambitious but am using it as a learning experience while I go.

My problem is that I have no idea how to do the following:

I have a folder that contains a lot of other folders, I would like to create a list in Applescript that contains the names of the folders inside my main folder (so that I can then use them further on in the script).

my script currently consists of the code required to get the number of sub-folders and is as follows.

set main_folder to "drive:folder:" as text

tell application "Finder"
        set num_folders to number of folders in entire contents of folder main_folder
end tell

Any tints or hips would be greatly appreciated :slight_smile:


From what I am reading I need to define a loop that will go from 0 to num_folders with each iteration of the loop adding a name to a list as the_list would then be used in later subroutines, it’s just finding out how to do it :s


Place this in the Finder tell block:

set folder_names to (name of every folder of folder main_folder)



Post removed because of sheer stupidity on my part

Thanks for the help it worked a treat :slight_smile:

You’re welcome,

That’s not stupid.