Archive for the ‘ICT’ category

Moving files around on OS X. (without losing the important bits!)

November 9th, 2009

If your moving shared files or directories around on os x you have to be particular careful about keeping all of the extra bids of data (permissions and resource forks).  If your doing it from the GUI then this will be done automatically, but if your working from a shell you need to be cautious as the ‘cp’ command, used on UNIX systems, will not keep these extras in tact.  Resource Forks make a users life simpler – among other things they allow the OS to know what program to open a file in if no extension is append to the files name.

The best methods for copying files on OS X are:
 

ditto -X <copy from> <copy to>

Flags:
X – Do not descend into directories with a different device ID if copying one or more source directories.

Usage:
For a one time copy.

 

rsync -vaR <copy from> <copy to>

Flags:
v -  Verbose.
a – Archive mode.
R – Use relative paths.

Usage:
Allows you to update a copied directory incrementally.  (eg it will only copy the files that need updating, not the whole data set).