GMind
GMind

Reputation: 31

moving one folder to another folder - applescript

I'm trying to move a user-selected folder to another folder, but I don't get it: whenever I look it up, it looks too complicated, even though I know it's not supposed to be.

Here's the code I have so far - please help:

choose folder with prompt "Select folder:"

on open of finderObject

  tell application "Finder" to move (finderObject) to folder "Library:Application Support"

end open

end

Upvotes: 0

Views: 259

Answers (1)

jweaks
jweaks

Reputation: 3792

First off, you have to assign the chosen folder to a variable. Also, many special folders in the OSX file structure have special names to get their paths, including the library and the application support folders. So, your script can simply be:

set finderObject to choose folder with prompt "Select folder:"
tell app "Finder" to move finderObject to folder (path to Application Support folder from local domain as string)

However, that is the root level Library folder. I suspect you will want to use the Application Support folder in the ~/ user domain. For that, change the "from local domain" to "from user domain".

Upvotes: 1

Related Questions