简体   繁体   中英

Using Apple Script to move multiple files from multiple folders to one

Found this forum while googling for my question, which I can't really find an answer for. I'm not a programmer, but I'm just trying to find out how I can use an AppleScript to move multiple files into one folder. I have a folder containing about 900 images and their corresponding text files which, after downloading, are each contained within an individual folder inside the first folder (so one image file and one text file per folder x 900.) I want to get these individual files out of their individual folders and have all 900 image files plus the 900 corresponding text files in one single folder, so I can look at all of the images at once. What is the correct script for doing this? I tried:

tell application "Finder"
move (every file of every folder of window 1) to (get target of window 1)
end tell

That's something someone on another forum suggested, but I'm getting error signs. Let's say my original folder containing the images is called "Single Images" and the folder I want to move them to is called "Single Images 2." Both folders are on the desktop. What is the right command to do this? Or is there another application that can do this more easily if Apple Script Editor isn't the right one?

Any help appreciated, it would save me hours of dragging and dropping if I can find the right command.

Thanks!

As long as all of the image and text files have unique names, this will work:

tell application "Finder"
    set sourceFolder to choose folder with prompt "Select Source Folder:"
    set destFolder to choose folder with prompt "Select Destination Folder:"
    move every file of (sourceFolder's entire contents) to destFolder
end tell

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM