Can't seem to make folder in Finder

Hi -

Sorry for the newbie-ishness of this question. I’ve got a script that first creates a series of folders using:

make new folder at the Desktop with properties {name: "batch"}

From there, I also add several folders inside the “disk1:Users:Me:Desktop:batch:” folder by just modifying the above path, like so:

make new folder at "disk1:Users:Me:Desktop:batch:" with properties {name: "first"}

So far so good. But…

Later in the script, I need to create more subfolders inside the “first” folder I made above. I can’t create them initially because I don’t know what their names are going to be yet. The names of the folders are generated from a list of files in another folder. What I don’t get is why the Finder will let me make new folders in one instance, and not let me make more folders later on. Please help - doesn’t seem to make sense, on the surface.

Here’s the offending code:

tell application “Finder” to set yList to get every file of folder “disk1:Users:Me:Desktop:anotherbatch:” --previously defined as variable anotherBatch
repeat with yFile in yList --cycle through files in folder
set yPath to anotherBatch & yFile as string --gets my path to each separate file in folder
set yfileName to name of yFile as string – gives me text for folder naming
make new folder at “disk1:Users:Me:Desktop:batch:first:” with properties {name: yfileName}
end repeat
end tell

The error AS gives me is "Can't make folder".



You can ease your pain with the addition of some well placed variables. :slight_smile:

tell application "Finder"
	set batch_ to make new folder at the desktop with properties {name:"batch"}
	--> folder "batch" of folder "Desktop" of folder "derek" of folder "Users" of startup disk
	set first_ to make new folder at batch_ with properties {name:"first"}
	--> folder "first" of folder "batch" of folder "Desktop" of folder "derek" of folder "Users" of startup disk
end tell

– Rob

Well, I tried that, and I still got the error “Can’t make folder.”

Could there be some kind of permission error that I’m not catching? I looked at the folders I created (~/Desktop/batch) thru Terminal and saw that the permissions were drwxr-xr-x for all folders.

Any other suggestions?

I thought maybe I could add more to the error that AS gave me, because maybe the clue is there as well.

I opened the Event Log and let the script fly. In the beginning, I could see :

tell application “Finder”
exists folder “disk1:Users:downsizing:Desktop:batch:”
make new folder at Desktop with properties {name: “batch”}
make new folder at “disk1:Users:downsizing:Desktop:batch:” with properties {name: “first”}

So, this part works right off the bat.

But, the next part, where I want to create more folders with names generated from the files, shows these events, up until the error:

tell current application
make new folder at current application with properties {name: “667-ABC”}
→ Can’t make a folder

So, why does this say “make new folder at current application” That doesn’t seem right, at least to this newbie.

Thanks again for any help you can offer.


Hmm, the script works fine here (OS X 10.2.6). I don’t know what all of that permission stuff translates to. If I am forced to deal with permissions (happens rarely), I do it in the Get Info window. :stuck_out_tongue:

Are the permissions correct for your desktop folder? Do you use StuffIt Expander and have it to set to expand files to the desktop? If so, I seem to recall a StuffIt Expander bug that messes up the permissions of the desktop folder.

– Rob