【问题标题】:Delete sub folders of current folder with applescript用applescript删除当前文件夹的子文件夹
【发布时间】:2020-08-04 18:45:25
【问题描述】:

我有这个简单的苹果脚本:

tell application "Finder"
set xfolder to target of Finder window 1
move files of entire contents of xfolder to xfolder
end tell

这会将当前文件夹子文件夹中的每个文件移动到父文件夹。

我希望它在移动文件后也删除此子文件夹。

无法让它工作......

【问题讨论】:

    标签: applescript subdirectory finder


    【解决方案1】:

    如果“删除”是指将文件夹放入垃圾箱,那么这应该可以。

    请记住,这里没有错误更正,因此(例如)如果层次结构中有重复名称的文件,则生成的错误将终止脚本。

    tell application "Finder"
        set xfolder to target of Finder window 1
        move files of entire contents of xfolder to xfolder
        delete folders of entire contents of xfolder
    end tell
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-07-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多