I am in the process of backing up a filesystem and I need to make sure that the metadata is conserved (the file owner and creation time).
The tarfile
module in Python is really helpful, and I use it extensively in my solution. However, I cannot create the tar file with files conserving their metadata (presumably because copy
and copy2
cannot do this).
How would you approach this problem from within Python?
EDIT:
Just to make it clear to the community: the tarfile
module in Python does provide means to store metadata via the Tarinfo
object. Essentially, a Tarinfo
object is the member of a Tar
object, and it has all the information you may need. Please refer to the accepted post.
Thanks!