我想要一些帮助来微调此脚本。该脚本是否可以匹配基于文件头两个字母的子文件夹?父文件夹将是“镜头”,其中包含具有唯一的两个字母前缀“BA_Bikini_Atol”的子文件夹,其中包含用于特定镜头ba_0020,ba_0030等的文件夹内的子文件夹。想要通过选择“镜头”将文件ba_0020_v0002移动到ba_0020文件夹“作为目标,脚本通过所有子文件夹查找匹配项。思考?Applescript - 将文件移动到文件夹名称以文件名的前2个字符开头的地方
set mgFilesFolder to (choose folder with prompt "Where are the files stored which you would like to move to the destination?")
set mgDestFolder to (choose folder with prompt "Where is the destination folder?")
tell application "System Events"
set folderList to name of folders of mgDestFolder
set fileList to name of files of mgFilesFolder
end tell
repeat with i from 1 to (count folderList)
set folderName to item i of folderList
set filesToMove to {}
repeat with j from 1 to (count fileList)
set filename to item j of fileList
if filename begins with folderName then
set end of filesToMove to alias ((mgFilesFolder as string) & filename)
end if
end repeat
tell application "Finder"
move filesToMove to alias ((mgDestFolder as string) & folderName & ":")
end tell
end repeat
不完全重复,但这个问题说明了如何基于文件名的开头移动文件:http://stackoverflow.com/questions/18397954/applescript-move-files -to-folder-which-name-starts-with-first-7-characters-of/ –
Darrick - 这是我正在使用的脚本,效果很好,但是如何让脚本查看子文件夹比赛? – Mull