Applescript: Get filenames in folder without extension

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

    Within a tell "Finder" block this collects file names stripped of the extension in myNames:

    repeat with f in myFiles
        set myNames's end to ¬
            (f's name as text)'s text 1 thru -(((f's name extension as text)'s length) + 2)
    end repeat
    

提交回复
热议问题