[Pythonmac-SIG] move/rename files w resource forks
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
> resource forks. Is this likely to be true with Python's os.rename ? If
> what is the recommended method to move or rename files? I'd prefer not
> use MvMac since most of the computers I administer do not have the
> developer tools installed.
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