John Miller
John Miller

Reputation: 13

Applescript - files to folder

I'm looking for a way to parse multiple folders to move all files into a new folder, and then a second script to move manually selected files to a new folder using applescript.

Upvotes: 0

Views: 151

Answers (1)

regulus6633
regulus6633

Reputation: 19032

To move all files in a folder, even files in subfolders, use this...

set parseFolder to choose folder with prompt "Choose the folder to parse"
set destinationFolder to choose folder with prompt "Choose the destination folder"

tell application "Finder"
    set foundFiles to files of entire contents of parseFolder
    move foundFiles to destinationFolder
end tell

To move the selected files use this...

set destinationFolder to choose folder with prompt "Choose the destination folder"

tell application "Finder"
    set selectedFiles to the selection
    move selectedFiles to destinationFolder
end tell

I hope this shows you how easy applescript can be and motivates you to start learning more. If you'd like to learn then you can go here and try the "Tutorials for beginning scripters".

Good luck.

Upvotes: 1

Related Questions