4

Problem: because of an unkown reason all my desktop files and folders were hidden. i managed do unhide all folders, but i can't unhide the files

i tried to unhide the files via terminal chflags nohidden filename but it doesn't work. i also checked if the hidden flag is placed, but there is no hidden flag on the files (but they aren't visible). here is the output via terminalcommand ls -lo:

-rw-r--r--@ 1 username 13669 19 Aug 11:54 filename.txt

i also tried an app called InvisibliX (which isn't under development anymore), with no success and of course i used the searching function, which lead me to this: How to unhide files on Mac? with no further success

I'm thankful for every hint you may have for me!

Some additional information regarding the OS: Mac OS X Catalina 10.15.6

9
  • 2
    So you did run chflags nohidden filename.txt and it didn't work?
    – nohillside
    Aug 31, 2020 at 9:25
  • yes, i tried the command. i also checked if chflags hidden filename.txtsets a flag (i checked via ls -lo but there was no change
    – schwing
    Aug 31, 2020 at 10:13
  • 1
    Your title & question body say you used unhide, which is not a valid command. Could you clarify which you in fact used. Does sudo make any difference? [as the files show only owner has permissions to write] Can you see the files if you set Finder to show invisibles Cmd/Shift/. stop/period? Do you see any error message?
    – Tetsujin
    Aug 31, 2020 at 10:35
  • Long shot, but you might also try xattr -d com.apple.FinderInfo [directory] Aug 31, 2020 at 11:25
  • @Tetsujin: you were right, i had written de command wrong (but only in the text here, not when i was trying to execute the command in the terminal. i made sure to not execute an invalid command. i have corrected the command in the text above (it's nohiddeninstead of unhide. an yes, i can see the files if i toggle the view setting via Cmd/Shift/. No error messages
    – schwing
    Aug 31, 2020 at 13:53

4 Answers 4

9

Once I copied files via terminal from an iPod to a Mac and somehow they appeared hidden, chflags nohidden <filename> did not work, neither the same command with different option flags. Finally, I found this answer which worked fine. So:

  1. xattr -d com.apple.FinderInfo <filename>
  2. chflags nohidden <filename>
  3. killall Finder (just in case)

I did it using * so I did not have to go one by one. Hope it helps,

2

I answered the same question and OP reported that the files got unhidden at first but got hidden later on. Looks like a bug to me.


It seems you need a recursive flag.

chflags -R nohidden ~/Desktop/folder

Then kill Finder to restart it.

killall Finder
4
  • i tried this on the files, but it didn't work. i also checked the flag via ls -lo after restarting finder, but there where no changes on the file
    – schwing
    Aug 31, 2020 at 13:55
  • @schwing See updated answer
    – anki
    Aug 31, 2020 at 14:05
  • that's exactly the same issue on my mac! i tried the solution procedure, but it doesn't work on files, only on folders. is there maybe a workaround, to copy files with the right (nohidden) flag?
    – schwing
    Aug 31, 2020 at 14:25
  • sorry I don't know..
    – anki
    Oct 1, 2020 at 7:21
1

If it does help, I found what I believe would be a bug. I tried to use recursive mode to unhide files within root and subfolders. As long as I would use only the path to Root folder (Documents) the terminal console output was; No such file or directory

sudo chlfags - R nohidden /Users/user/Documents/

When I copied whole path to the file (use Command+shift+[.] to show hidden files first in Finder), hid or unhid a file within Documents folder, I was also able to just remove the file name from the path and then successfully execute Recursive action to hide/unhide all files and folders within Documents. Is this does look and feel like a bug to me.

Workaround:

chflags - R nohidden  /Users/user/Documents/filename.txt

the file was then visible.

Next step, remove the file name from the path and repeat command, to either hide or unhide.

chflags - R nohidden  /Users/user/Documents/

No need to kill Finder to confirm, just move between folder up or down to refresh the window. It worked for me on Big Sur Mac OS.

0

Maybe you didn't use chflags hidden instead, setfile -a V.

1
  • based on /usr/bin/getfileinfo filename|folder output in the Terminal, chflags hidden|nohidden and setfile toggle the same v|V attribute-letter flag. Also, hidden|nohidden is more readable and less vulnerable to lower|upper casing a single letter.
    – l --marc l
    May 29, 2021 at 3:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .