我试图创建一个文本文件,我的ffmpeg命令可以用来合并两个视频文件。我遇到的问题是让我的文件夹/文件路径看起来像我想要的。这两条线引起我的问题是:如何将AppleScript路径转换为posix路径并传递给shell脚本?
set theFile to path to replay_folder & "ls.txt"
我只想把这个路径的replay_folder
和ls.txt
路径在shell脚本行我希望同样的事情。
do shell script "cd " & replay_folder & " /usr/local/bin/ffmpeg -f concat -i ls.txt -c copy merged.mov"
我得到的shell脚本Macintosh HD:Users:BjornFroberg:Documents:wirecast:Replay-2017-03-17-12_11-1489749062:
这条道路,但我想这/Users/BjornFroberg/Documents/wirecast/Replay-2017-03-17-12_11-1489749062/
完整的代码是:
tell application "Finder"
set sorted_list to sort folders of folder ("Macintosh HD:Users:bjornfroberg:documents:wirecast:") by creation date
set replay_folder to item -1 of sorted_list
set replay_files to sort items of replay_folder by creation date
end tell
set nr4 to "file '" & name of item -4 of replay_files & "'"
set nr3 to "file '" & name of item -3 of replay_files & "'"
set theText to nr4 & return & nr3
set overwriteExistingContent to true
set theFile to path to replay_folder & "ls.txt" --actual path is: POSIX file "/Users/BjornFroberg/Documents/wirecast/Replay-2017-03-17-12_11-1489749062/ls.txt"
set theOpenedFile to open for access file theFile with write permission
if overwriteExistingContent is true then set eof of theOpenedFile to 0
write theText to theOpenedFile starting at eof
close access theOpenedFile
do shell script "cd " & replay_folder & "
/usr/local/bin/ffmpeg -f concat -i ls.txt -c copy merged.mov"
任何帮助表示赞赏:)
这工作完美。谢谢! HFS代表什么? –
[分层文件系统](https://en.wikipedia.org/wiki/Hierarchical_File_System) – vadian