如何在包含Apple脚本的文件夹中获取最新创建文件的路径?

时间:2015-02-04 14:00:24

标签: applescript filepath

我想获取文件夹测试

中创建的最后一个文件的路径
set p to "/Users/palmglow/Documents/googledrive/orders/IFTTT/test"
set a to POSIX file "/Users/palmglow/Documents/googledrive/orders/IFTTT/test/"
set latestFile to last item of (sort (get files of (POSIX file "/Users/palmglow/Documents/googledrive/orders/IFTTT/test")) by creation date) as alias

1 个答案:

答案 0 :(得分:0)

尝试:

set myFolder to "/Users/palmglow/Documents/googledrive/orders/IFTTT/test"
tell application "Finder" to set latestFile to item 1 of (sort files of (POSIX file myFolder as alias) by creation date) as alias