Hide any File or Folder by Making it Invisible to the Mac OS X Finder with setfile
If you ever want to hide a file or folder, you can quickly make it invisible with a command line utility called setfile. This is a really cool tip that should be particularly useful to those who share their mac with other people.
I use this trick all the time to hide my personal files before my roommate uses my computer, and it’s easy to do if you know how. At the same time, it’s unlikely that another user will even think to look in a directory via the Terminal to find the file.
Make a file or folder invisible in Mac OS X Finder
You’ll need to open Terminal to get started, then just use the following syntax:
setfile -a V testfile.txt
Poof! Like magic, the file or folder is no longer visible via the Finder GUI, but don’t worry your files are still there and you can find them via the command line and will show with an ls command. If you want to make your files and folders visible again, use this command:
Make a file or folder visible again in Mac OS X Finder
setfile -a v testfile.txt
Now the file/folder will be visible again to the Finder, cool huh?
Note: setfile is a command line utility included in Apple’s Developer Tools, which is a highly recommended optional install included on any Mac OS X install/restore CD/DVD and also available as a rather large download from Apple’s Developer center. If you want to use setfile without installing Developer Tools you can try this trick on macosxhints.com. Thanks for pointing this out Albert!