【发布时间】:2016-07-13 12:58:19
【问题描述】:
我正在寻找可以使用名称列表(电子表格或 .csv)来搜索目录及其子目录的自动化工作流程或 applescript(但我还不熟悉该语言)特定文件名(具有不同的扩展名)并将该图像复制到为这些图像创建的文件夹中。
我找到了一个似乎与我需要的有点相似的脚本,但它不在子目录中搜索,所以我实际上还没有找到任何带有它的图像。
经过广泛的研究,我发现 2 个不同的脚本似乎是我需要的,但它们似乎都没有搜索子目录。以下是我尝试过的 2 个脚本。如果有人可以帮助我让这些搜索子目录,我将不胜感激!
脚本 1:
set thePhotos to paragraphs of (read (choose file with prompt "Choose a text file"))
set theSourceFolder to (choose folder with prompt "Choose source folder")
set theDestination to (choose folder with prompt "Choose destination folder")
set dupeList to {}
repeat with theName in thePhotos
try
set end of dupeList to alias ((theSourceFolder as text) & theName)
end try
end repeat
tell application "Finder" to duplicate dupeList to theDestination with replacing
set theCount1 to (count of dupeList) as text
set theCount2 to (count of thePhotos) as text
display dialog (theCount1 & " of " & theCount2 & " items copied to " & (theDestination as text)) buttons {"OK"}
脚本 2
set fileContents to read (choose file with prompt "Choose a comma-delimited text file")
set theText to result
set AppleScript's text item delimiters to ","
set theTextItems to text items of theText
set AppleScript's text item delimiters to {""}
theTextItems
set theSourceFolder to (choose folder with prompt "Choose source folder") as string
set theDestination to (choose folder with prompt "Choose destination folder")
repeat with theEPSName in theTextItems
tell application "Finder"
set theEPSFile to theSourceFolder & theEPSName
move file theEPSFile to folder theDestination with replacing
end tell
end repeat
所以它让我选择要使用的 .csv,选择要保存的目录并选择要搜索的目录。我怎样才能让这个脚本在子目录中搜索?对于了解 Applescript 的人来说,这看起来是否可以按需运行?
提前感谢您!我非常感谢任何帮助,因为这是我的第一次 Applescript 体验,但我很高兴学习它!
【问题讨论】:
标签: macos applescript automator