[Pythonmac-SIG] move/rename files w resource forks

Bob Ippolito bob at redivi.com
Mon Nov 15 18:14:08 CET 2004

On Nov 15, 2004, at 7:06 PM, brad.allen at omsdal.com wrote:

> I read somewhere that the "mv" command doesn't properly handle files 
> with
> resource forks. Is this likely to be true with Python's os.rename ? If 
> so,
> what is the recommended method to move or rename files? I'd prefer not 
> to
> use MvMac since most of the computers I administer do not have the 
> Apple
> developer tools installed.
> Thanks!

No POSIX functions handle files with resource forks, and Python's os 
module on OS X and several other operating systems is all POSIX code.

You have three options:
1. Use command line tools that understand forks (MvMac, etc.), this is 
a bad idea
2. Use NSFileManager from PyObjC
3. Use the Carbon functions (probably in the Carbon.File module).

#2 is definitely the easiest, #3 works on a stock installation.


More information about the Pythonmac-SIG mailing list