Terminal 正在applescript中移动哪个文件
你好 我有一个基本的applescript,它将最旧的文件从一个文件夹移动到另一个文件夹。我正在从命令行运行applescript:Terminal 正在applescript中移动哪个文件,terminal,applescript,Terminal,Applescript,你好 我有一个基本的applescript,它将最旧的文件从一个文件夹移动到另一个文件夹。我正在从命令行运行applescript: osascript/Users/dmayo/Documents/scripts/moveolests.scpt 我也有脚本stdout到终端,但似乎不能只引用文件名。下面是我在代码中的一行中得到的信息,记录此项目: «class docf» 2016-04-12-01-31-31.pdf of «class cfol» 2013-long of «class
osascript/Users/dmayo/Documents/scripts/moveolests.scpt
我也有脚本stdout到终端,但似乎不能只引用文件名。下面是我在代码中的一行中得到的信息,记录此项目:
«class docf» 2016-04-12-01-31-31.pdf of «class cfol» 2013-long of «class cfol» Scans of «class cfol» dmayo of «class cfol» Users of «class sdsk»
我只想在输出的每一行上显示文件名“2016-04-12-01-31-31.pdf”。这是我的申请书:
谢谢。只需记录物品的名称
编辑:由于log
不属于查找器,请将其移出查找器提示块
repeat
tell application "Finder"
set src to folder "Macintosh HD:Users:dmayo:Scans:2013-long"
set dest to folder "Macintosh HD:Users:dmayo:Scans"
set sorted_list to sort items of src by creation date
set this_item to item 1 of sorted_list
move this_item to dest
set fileName to name of (this_item as alias)
end tell
log fileName
delay 120
end repeat
不。终端中的标准输出结果为:name of«class docf»2016-04-12-01-31-31.pdf of«class cfol»2013 long of«class cfol»扫描«class cfol»dmayo of«class sdsk»用户
Nope。相同的长输出。奇怪。您正在记录文件名
而不是此项目
?如果将fileName设置为name of(此项作为别名)
宾果,会发生什么。谢谢在哪里可以找到关于括号的文档?括号的使用方式与算术中封装表达式的方式相同。我想它是被水覆盖着的
repeat
tell application "Finder"
set src to folder "Macintosh HD:Users:dmayo:Scans:2013-long"
set dest to folder "Macintosh HD:Users:dmayo:Scans"
set sorted_list to sort items of src by creation date
set this_item to item 1 of sorted_list
move this_item to dest
set fileName to name of (this_item as alias)
end tell
log fileName
delay 120
end repeat