moving files to a folder

Hello, I’m totally new at this but I’d only like to do one thing: move a bunch of files to new folder located in the same folder the files are located in. It seems like this would be pretty simple so I’m hoping someone has a simple script which can do this for me. Or is this too simple?

Model: powerbook g4
Browser: Safari 412.5
Operating System: Mac OS X (10.4)


You can do this in a couple ways:

  1. You can “hard code” your folder locations such as
tell application "Finder"
	set myFold to folder "folderName" of folder "Desktop" of folder "userName" of folder "Users" of startup disk
end tell


tell application "Finder"
	set myFold to "folderName:Desktop:userName:Users:harddriveName:"
end tell

Note that in the last example that if you’re trying to identify a folder that the last item in the line (the colon) is necessary. If you leave out the colon, this signifies to the Finder that you are wanting a file. So no colon: file, colon: folder

You can also use AppleScript to choose a folder as such.

set myFold to choose folder with prompt "Choose folder with files to move."
set destFold to choose folder with prompt "Choose your destination."

This is quite often easier and also makes the script more transportable to another machine. So to completely answer your question:

set destFold to choose folder with prompt "Choose your destination folder."
set theFiles to choose file with prompt "Choose files to move." with multiple selections allowed -- use the command key to make multiple selections (or the shift to select a range).
tell application "Finder"
	move theFiles to folder destFold
end tell

This should get you started.


thanks! it works great! Just what I needed!

Uh, one more thing. Is there anyway I can run this without running it from the script editor? As I said I’m a total newbie at this. I promise to buy a book about scripting today.

You can save it as an application which can be launched by double-clicking the application icon. I would recommend unchecking the Startup Screen box when saving as this will save you from having to click Run when launched.

thanks for the help. It works great!