[Mac] file copy

Philip Semanchuk philip at semanchuk.com
Tue Jun 23 11:13:38 EDT 2009

On Jun 23, 2009, at 10:54 AM, Diez B. Roggisch wrote:

> Tobias Weber wrote:
>> Hi,
>> which is the best way to copy files on OS X? I want to preserve  
>> resource
>> forks and extended attributes.
> Are these still relevant on OSX? I've always only copied files  
> directly, and
> never had any troubles.

I think resource forks are now stored as extended attributes, and  
Apple's version of cp is aware of extended attributes.

Try this -- create a text file via terminal using `touch foo.txt`. In  
Finder, click "get info" on the file and change it to open with  
anything other than TextEdit (e.g. Firefox).

Now go back to terminal and look at the file. It's still zero bytes  
long, but try the command `xattr foo.txt` --

$ xattr foo.txt

Also --
$ cp foo.txt bar.txt
$ xattr bar.txt

xattr -h gives options for this command.

To the OP -- I remember reading somewhere that xattr is written in  
Python. You might find it useful or even be able to import it directly.


More information about the Python-list mailing list