applescript get only file name of a folder

对着背影说爱祢 提交于 2019-12-11 13:22:43

问题


I have the following script that list the contents (files and folder) of a folder

 set the_files to (list folder (choose folder) without invisibles)

e.g folder root has a file text1.txt and folders subroot2 and subroot3

but how can I get just the file name (only text1.txt) of a folder root (exclude subroot2 and subroot3)? thanks


回答1:


tell application "Finder"
    files of folder (choose folder) -- Finder file objects
    name of files of folder (choose folder) -- names of files
end tell


来源:https://stackoverflow.com/questions/20274722/applescript-get-only-file-name-of-a-folder

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!