Ben Kial:
I need to write a program to "copy" files and preserved the files'
atime, mtime, ctime, file permissions. I also need to have this
program working in Unix and Windows, where the "Archive"
attribute on the file also has to be preserved (any more
Windows idiosyncrasies?).
The platform copy utilities know more than you want to about file
attributes including Read-only, Hidden, Archive, and System bits, compressed
and encrypted attributes, access control lists, multiple forks and further
esoterica. It probably even has a reasonable idea what to do when the
destination file system is different to the source and so may not, for
example, be able to use Unicode file names or ACLs. On Windows, you could
start with something like
os.system("xcopy /K /X /I c:\\os\\s4\\win32 g:\\xxx")
Another approach is to use the native SHFileOperation API although this
is not wrapped by the Win32 extensions. You could use ctypes to access it.
Neil