简体   繁体   English

使用Apple Script将多个文件夹中的多个文件移动到一个文件夹

[英]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. 我不是程序员,但我只是想知道如何使用AppleScript将多个文件移动到一个文件夹中。 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. 我有一个包含大约900个图像及其相应文本文件的文件夹,下载后,每个文件夹都包含在第一个文件夹内的单个文件夹中(因此每个文件夹一个图像文件和一个文本文件x 900.)我想得到这些个人文件来自他们各自的文件夹,并且在一个文件夹中包含所有900个图像文件和900个相应的文本文件,因此我可以一次查看所有图像。 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." 假设包含图像的原始文件夹称为“单个图像”,我想将其移动到的文件夹称为“单个图像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? 或者,如果Apple脚本编辑器不正确,还有另一个应用程序可以更轻松地执行此操作吗?

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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