kuruvi
kuruvi

Reputation: 653

applescript get only file name of a folder

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

Upvotes: 1

Views: 935

Answers (1)

Lri
Lri

Reputation: 27633

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

Upvotes: 1

Related Questions