How do I hide files?

Discussion in 'macOS' started by SecurityTinker, May 19, 2008.

  1. SecurityTinker macrumors newbie

    May 11, 2008
    I have a flash drive that I use on both Macs and PCs. There are files that need to be in the root directory of the drive. (autorun.inf) I do not want to see this file, so in Windows, I just right click on it and check "Hidden". But when I plug the drive into a Mac, I see all these files. I want them to be hidden in both Explorer in windows and Finder on a Mac. Is there any way to do this without renaming the files?

    I want to hide them for the sake of hiding them.

    • It's not sensitive material
    • It still needs to be readable by Windows
    • I want to hide them to make the root of the drive look nicer. Example: When people are browsing your Mac, you don't want them to see the var and etc directories on the system drive. It doesn't look nice!
  2. The General macrumors 601

    Jul 7, 2006
    Make it hidden in Windows and name the Folder with a . at the front of it.
  3. SecurityTinker thread starter macrumors newbie

    May 11, 2008
  4. GotPro macrumors 6502

    Jan 29, 2007
    There are a couple of ways to do this.

    The first is to enable the invisibility bit on each individual file by use of a command line tool (part of the developer's tools that came on your OS X installation discs-- you may have to install them) called SetFile.

    The command is something like this:

    SetFile -a V filename

    After doing this, you will need to quit and relaunch the finder for the changes to take effect.

    The second way is to create a file using vi in terminal called /.hidden

    This was used in OS X 10.3 to maintain a list of files to always hide. While obsolete in 10.4 and above, the Finder (at least in 10.4... haven't tried it yet in leopard) will still respect the list if it is in fact there.

    Make sure you use vi or something similar to create / edit the file to ensure you don't have anything uninterpretable accidentally being inserted in the file...

    In the /.hidden file, you'll want to list the COMPLETE PATH to every single file that you want to hide.

    Again, you'll need to quit and re-launch the Finder before the changes take effect.
  5. SecurityTinker thread starter macrumors newbie

    May 11, 2008
    Thanks guys, but on another forum they've suggested JuhOS X, and it's worked surprisingly well. (At least for the small task I wanted to perform)

Share This Page