osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


Skip,

On 3/04/19 8:06 AM, Skip Montanaro wrote:
> 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.

Is there an (unstated) reason why you're using Python and not a system 
tool such as rsync?

-- 
Regards =dn