Moving folders with content

Nobody nobody at nowhere.com
Sat Sep 15 04:00:16 EDT 2012


On Sat, 15 Sep 2012 04:36:00 +0000, jyoung79 wrote:

> I am working in both OS X Snow Leopard and Lion (10.6.8 and 10.7.4).  
> I'm simply wanting to move folders (with their content) from various 
> servers to the hard drive and then back to different directories on the 
> servers.
> 
> I want to be careful not to remove any metadata or resource forks from 
> the files in the directories.  I did a bit of researching on shutil, and 
> looks like it is similar to using "cp -p" and copystat(), which I believe 
> will keep the resource fork, etc.

I don't think so. The shutil documentation says:

	Warning

	Even the higher-level file copying functions (copy(), copy2()) can’t
	copy all file metadata.

	On POSIX platforms, this means that file owner and group are lost as well
	as ACLs. On Mac OS, the resource fork and other metadata are not used.
	This means that resources will be lost and file type and creator codes
	will not be correct. On Windows, file owners, ACLs and alternate data
	streams are not copied.

The macostools module has functions which can copy the resource fork, but
they aren't available in 64-bit builds and have been removed in Python 3.0.




More information about the Python-list mailing list