AppleScript覆盖或跳过命令?

AppleScript覆盖或跳过命令?,applescript,finder,Applescript,Finder,我有下面的applescript,它获取文件并将它们放在相应的文件夹中 set sourceFolder to choose folder tell application "Finder" set theFiles to files of sourceFolder repeat with aFile in theFiles set fileName to name of aFile if fileName contains "#" then set pou

我有下面的applescript,它获取文件并将它们放在相应的文件夹中

set sourceFolder to choose folder

tell application "Finder"
set theFiles to files of sourceFolder

repeat with aFile in theFiles
    set fileName to name of aFile

    if fileName contains "#" then
        set poundOffset to offset of "#" in fileName
        set folderName to text 1 thru (poundOffset - 2) of fileName

        set newFolder to (sourceFolder as text) & folderName & ":"
        if not (exists folder newFolder) then
            make new folder at sourceFolder with properties {name:folderName}
        end if

        move aFile to folder newFolder
    end if
end repeat
结束语

它对我来说非常有用,除了在文件冲突的情况下。如果文件夹中的文件与脚本中的文件同名,则脚本会出错并崩溃。所以我的问题是…我该怎么解决?我希望它只是覆盖文件,但有没有办法弹出一个跳过文件的提示,或者干脆一起跳过,然后转到下一个

我对我在这里能做什么有点模糊。提前谢谢你的帮助

流氓

试试看:

move aFile to folder newFolder replacing true