Applescript: Get filenames in folder without extension

前端 未结 8 1825
忘掉有多难
忘掉有多难 2020-12-11 03:36

I can get the names of all files in a folder by doing this:

tell application \"Finder\"
    set myFiles to name of every file of somePath
end tell

8条回答
  •  误落风尘
    2020-12-11 04:02

    I don't know how to remove the extensions when you use the "every file" syntax but if you don't mind looping (loop not shown in example) through each file then this will work:

    tell application "Finder"
      set myFile to name of file 1 of somePath
      set myFile2 to text 1 thru ((offset of "." in myFile) - 1) of myFile
    end tell
    

提交回复
热议问题