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!
my problem is bit different
i’ve dual partition with windows
i’ve hidden some files in windows
n i want to upload it from mac
i cant find it on “Choose Files” dialogue tab
and its doesn’t have a ” . ” on initial file name but it still hidden
how to make it become visible??
Hit Command+Shift+Period in the dialog window
https://osxdaily.com/2011/03/01/show-hidden-files-in-mac-os-x-dialog-boxes-with-commandshiftperiod/
Rename a file/folder with a “.” as first character.
Finder does not allow this, so with the Bash:
mv foo.txt .foo.txt
* “.” (without quotation marks)
[…] which allows you to set any directory or file as invisible, you can read more about hiding files and folders with setfile in Mac OS X, but the limitations on visibility are practically identical to the above technique: file is […]
[…] at https://osxdaily.com/2009/08/11/hide-any-file-or-folder-by-making-it-invisible-to-the-mac-os-x-finder… March 2nd, 2010 in Macintosh […]
Nice little trick! If one uses this on a folder, one can still access it in Finder using the “goto” command (Shift-Cmd-G) and typing the path.
I have installed Snow Leopard and have tried typing this SetFile command. It is not an actual command as far as I can tell.
[…] https://osxdaily.com/2009/08/11/hide-any-file-or-folder-by-making-it-invisible-to-the-mac-os-x-finder… […]
If I don’t want to share certain files, I use Disk Utility to create an encrypted disk image, then, because no-one likes stuff being kept from them (“I thought you trusted me etc etc?”), I copy-paste a folder icon onto the dmg and give it a system-file-esque sort of name with the extension hidden.
It ends up effectively being a password-protected (yet totally average looking) folder, and there’s not much chance of accidentally leaving it available to others (it clearly mounts on the desktop with the drive icon and only needs ejecting when you’re done with it)
best “new mac user” answer and method I found for quickly easily hiding files and folders on mac.
It’s SetFile, not setfile…
It’s SetFile, not setfile…
It’s SetFile, not setfile…
It’s SetFile, not setfile…
Wonders if this command can be put into an AppleScript, thus more easily called when one wants to hide/show a certain folder. (And name it something that doesn’t reveal it’s true operation).
An even better way to hide folders from roommates is to set up a ‘Guest’ account so others can use your computer without prying into your files. Simply logging out of your account or set up a screen saver password seems easier than pulling up the terminal, etc.
‘setfile’ is an utility from Apple’s developer’s kit and is not included in default Leopard install.
‘setfile’ is not a Leopard command, is it?