Applescript无法正确排序文件夹

时间:2018-10-14 22:53:58

标签: applescript

我的设置是...

桌面/文件夹

...具有图片和视频。它们的标题形式为:“ Name1_01”

我想要的是Applescript根据名称中_符号前的部分移动图片,并根据需要创建新文件夹...

桌面/文件夹/照片名称1;

桌面/文件夹/照片名称2;

桌面/文件夹/照片名称3;

...等等。

我该怎么做?我尝试了此示例代码...

property sourceFolder : "HDD:Temp:Sorting"

tell application "Finder"
    repeat with aFile in (get files of folder sourceFolder) as alias list
        set fileName to name of aFile
        if fileName starts with "DK" then
            set prefix to text 1 thru 4 of fileName
            if not (exists folder prefix of folder sourceFolder) then
                make new folder at folder sourceFolder with properties {name:prefix}
            end if
            move aFile to folder prefix of folder sourceFolder
        end if
    end repeat
end tell

但是当我将其放入终端时,它只是返回一个错误,并说我需要安装xcode。

0 个答案:

没有答案