MacOS – Preserving “hidden” attribute when copying from NTFS to HFS+

backupfindermacosntfsrsync

I have an NTFS volume that I am copying into a new HFS+ volume. I'm using the following command to copy everything including all hidden directories and attributes:

sudo rsync -aAXvF --del --chmod=F-x,go-w /Volumes/NTFS/ /Volumes/HFS

The F-x,go-w is there to fix the permissions from NTFS (which has simply rwxrwxrwx on everything). -a (archive), -A (ACLs), and -X (xattrs) force rsync to copy as much file metadata as possible.

However, one quirk of this copy is that Windows hidden files (e.g. $RECYCLE.BIN, System Volume Information, etc.) still show up as visible in HFS+. Is there a flag I could pass to rsync or a similar command that could preserve this metadata bit?

Best Answer

I don't have a ntfs partition to test it, but my man rsync documents the -E switch:

-E, --extended-attributes
          Apple specific option to copy extended attributes, resource forks, and ACLs.
          Requires at least Mac OS X 10.4 or suitably patched rsync.

I don't know if that helps, but it's worth a try.


Another thing to try would be to use the ntfs-3g driver to mount the partition, which includes the hide_hid_files option:

Hide the hidden files and directories in directory listings, the hidden files and directories being the ones whose NTFS attribute have the hidden flag set. The hidden files will not be selected when using wildcards in commands, but all files and directories remain accessible by full name, for example you can always display the Windows trash bin directory by : "ls -ld '$RECYCLE.BIN'".

I assume ntfs-3g translates ntfs' hidden attribute before presenting the file to the system. rsync might then be able to preserve it. ntfs-3g can be installed via Homebrew.


If that fails, too, you will likely have to hide the files yourself. To do so you may use either chflags hidden <file> or prepend the file with a .. Both will hide the files in Finder. If you use the terminal frequently, you may prefer prepending the ., as it also hides the files from regular ls output (without the -a switch)