问题
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