Creating and Moving an Invisible file with OS X 10

2019-08-19 05:00发布

问题:

I'm fairly new to using the terminal, but have so far figured out through various forums how to hide a file from the Finder, but once hidden, I'm obviously unable to move it to the flash drive I want to keep it on, and I can't figure out any way hide the file after it's moved off of the internal drive. I'm using the command line:

Computer-name:~ User$ chflags hidden /users/me/desktop/filename.txt

How do I move the file once it's hidden, or how would I alter the command to hide the file after it's been moved to the flash drive?

回答1:

Definitely this is an AskDifferent ( https://apple.stackexchange.com/ ) kind of question but at the same time, it's pretty straightforward to answer.

1) simply move the file to your flash drive

and then

2) hide it after it's copied /moved to the flash drive using "chflags hidden" and the path to where it lives on the flash drive. Another option is to use "SetFile -aV path/to/file.txt"

And just because it's hidden from the Finder doesn't mean you can't see it when you type in "ls" in Terminal. So you can reverse the steps and copy after you make the file invisible.