我正在尝试搜索多个图像的文件夹,并将文件名中包含_master的图像移动到其他文件夹。以下是我所取得的成绩,但我一直在收到错误
无法获得文件夹
tell application "Finder"
set the_files to get every file of folder "Mac HD:Users:anthonypassler:Desktop:skincare:"
end tell
tell application "Finder"
repeat with this_file in the_files
if name of this_file ends with "master.png" then
move file this_file to folder "Mac HD:Users:anthonypassler:Desktop:skincare:Test"
end if
end repeat
end tell
end
无法获得文件夹
表示路径无效,可能拼写错误。
由于当前用户的桌面文件夹是Finder的根文件夹,因此有一个较短的形式:
tell application "Finder"
set the_files to files of folder "skincare"
repeat with this_file in the_files
if name of this_file ends with "master.png" then
move this_file to folder "Test" of folder "skincare"
end if
end repeat
end tell
然而,还有第二个错误:您必须删除移动行中的file
关键字,因为this_file
已经是文件说明符。