fs package question - cp -p semantics when copying files?

Skip Montanaro skip.montanaro at gmail.com
Tue Apr 2 15:06:44 EDT 2019


I posed this yesterday on the PyFilesystem discussion Google Group but
it's so far not even garnered a single view, so perhaps that group is
defunct. I turn to the knowledgeable folks here:

I am copying files from one filesystem instance to another. I see no
(easy) way to tell fs.copy.copy_fs to preserve file permissions when
copying files (the equivalent of the cp(1)'s -p flag). So, accessed,
created, modified times, as well as permissions. It seems I need to
craft a dictionary with only marginally documented structure, which I
can then pass to the destination filesystem's setinfo method,
something like this:

    dst_fs.setinfo(dst_path, <details_dict>)

I suspect I will figure this out (painfully), but if someone has some
hints, they'd be appreciated.

Thanks,

Skip



More information about the Python-list mailing list