Applescript:将allFiles设置为在子文件夹上运行的整个内容的每个文件?

时间:2014-07-27 18:52:39

标签: applescript

我正在使用脚本批量转换一堆m4v到一个set framesize,并使用这个脚本。但是,如果我父文件夹(Omkodning)中的文件夹有自己的文件夹,则它不会查看该文件夹。由于我的heriarchi比一个文件夹更深,所以这个脚本不能一直工作。如何更改它以搜索我的父文件夹(Omkodning)的整个内容?

--on adding folder items to this_folder after receiving these_items
with timeout of (720 * 60) seconds
tell application "Finder"
    --Get all m4v files that have no label color yet, meaning it hasn’t been processed
    set allFiles to every file of entire contents of ("FIRSTHD:Users:jerry:Desktop:Omkodning" as alias) whose ((name extension is "m4v") and label index is 0)
    --Repeat for all files in above folder
    repeat with i from 1 to number of items in allFiles
        set currentFile to (item i of allFiles)
        try
            --Set to gray label to indicate processing
            set label index of currentFile to 7
            --Assemble original and new file paths
            set origFilepath to quoted form of POSIX path of (currentFile as alias)
            set newFilepath to (characters 1 thru -5 of origFilepath as string) & "mp4'"
            --Start the conversion
            set shellCommand to "nice /Applications/HandBrakeCLI -i " & origFilepath & " -o " & newFilepath & " -e ffmpeg4 -b 1200 -a 1 -E faac -B 160 -R 29.97 -f mp4 –crop 0:0:0:0 crf 24 -w 640 -l 480  ;"
            do shell script shellCommand
            --Set the label to green in case file deletion fails
            set label index of currentFile to 6
            --Remove the old file
            set shellCommand to "rm -f " & origFilepath
            do shell script shellCommand
        on error errmsg
            --Set the label to red to indicate failure
            set label index of currentFile to 2
        end try
    end repeat
end tell
end timeout
--end adding folder items to

1 个答案:

答案 0 :(得分:1)

删除了这个,现在似乎有用了。

and label index is 0)