Applescript: Get filenames in folder without extension

前端 未结 8 1827
忘掉有多难
忘掉有多难 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:01

    Here's an applescriptish method to get Finder's idea of what the stripped filename is but please note it will only work if you have NOT enabled the option in Finder's preferences to "Show all filename extensions":

    set extension hidden of thisFile to true
    set thisName to displayed name of thisFile
    -- display dialog "hey"
    set extension hidden of thisFile to false
    

提交回复
热议问题