Applescript从特定文件夹名称移动所有文件。

时间:2016-08-01 02:00:50

标签: applescript finder

我的驱动器有多个“已批准”文件夹,其中包含文件。

已批准的文件夹位于驱动器上的不同位置。

我需要通过applescript将Approved文件夹的内容移动到另一个目录。

这是我到目前为止所提出的,但似乎没有做到这一点,它运行但没有文件被移动......

任何提示都会很棒

由于

 set sourceFolder to "THIS:" as alias
 set destinationFolder to "THAT:" as alias
   tell application "Finder"
       repeat with aFolder in (get folders of sourceFolder)
          set folderName to name of aFolder
          set filesToMove to (files of sourceFolder whose name = "Approved")
          move filesToMove to destinationFolder
       end repeat
   end tell

1 个答案:

答案 0 :(得分:0)

根据您的说明,您正在寻找名为“已批准”的文件夹,但您的脚本正在搜索名为“已批准”的文件。试试这个:

set sourceFolder to choose folder
set destinationFolder to choose folder
tell application "Finder"
        repeat with aFolder in (get folders of sourceFolder)
            if aFolder's name is "Approved" then
                set filesToMove to (files of aFolder)
                move filesToMove to destinationFolder
            end if
        end repeat
    end tell