[Pythonmac-SIG] move/rename files w resource forks
mark.asbach at post.rwth-aachen.de
Mon Nov 15 18:49:28 CET 2004
Hi Brad, hi list,
> Yes, that's great for copying, but not for move/rename. In this case, until
> I have implemented a better way, I'm using ditto as a very inefficient
> "move" by deleting files from one directory and using ditto -rsrc to copy
> to a different directory.
You could just use the 'mv' command or its python equivalent to move the resource fork: it's accessible transparently via 'filename/RSRC' throughout the whole Mac OS posix APIs. That means
mv somefile newdirectory/
test -d somefile/RSRC || mv somefile/RSRC newdirectory/
will do everything necessary on Mac OS X and just ignore the rest of the second line on other systems.
Didn't try with Python, but it should work fine.
More information about the Pythonmac-SIG