Question

I know that I can open the file information dialogue (Get Info) for several files at once using ⌘⌥I and hide/unhide file extensions. How do I accomplish this for all files in a directory tree (including files in subfolders)?

Was it helpful?

Solution 2

Ok, I found a solution using Hazel:

I created a rule based on their posting How to get Hazel to go into subfolders:

If (…) Kind is Folder

Do the following (…) run rules on folder contents

The next rule selects a certain set of files, e.g.

If (…) Kind is pdf

Do (…) Run AppleScript embedded script

The script is

tell application "Finder"
    set extension hidden of theFile to true
end tell

I defined more conditions more different file types, so it doesn’t work on all files as requested. With a limited number of different file types this should be no problem.

OTHER TIPS

You can easily do this in Terminal with the SetFile command:

To hide file extensions in a directory and all sub-directories:

cd <path to directory>

find . -name "*.*" -exec SetFile -a -E '{}' \; | echo "hiding extensions"

(can change the second * to a particular extension type if you choose)

To show file extensions in a directory and all sub-directories:

cd <path to directory>

find . -name "*.*" -exec SetFile -a -e '{}' \; | echo "showing extensions"
Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange
scroll top