xrootd / xrootd-python

Python bindings for XRootD are now part of the main repository.
https://github.com/xrootd/xrootd
6 stars 8 forks source link

client.FileSystem.copy : allow directory as destination #5

Closed chaen closed 10 years ago

chaen commented 10 years ago

Hi,

When you use the xrdcp command line, you can give a directory as destination, in which case the file will be named as the original one. With the python api, using a directory as a destination results in an error stating : "[ERROR] OS Error: Is a directory" First of all it would be useful to write which of the argument (source/target) is a folder. Also, for sake of consistency with the xrdcp command line, could you apply the same policy?

Many thanks Chris

ljanyst commented 10 years ago

Hello Chris,

the python copy API is an interface to the CopyProcess C++ class not xrdcp. CopyProcess accepts a list of full (absolute) and possibly unrelated URLs. xrdcp on the other hand accepts only two URLs, even in recursive mode. xrdcp checks if one or both of them are directories and acts accordingly building and supplying CopyProcess with a list of final URLs (CopyJobs), sometimes these are entire subtrees. Since the copy jobs within the CopyProcess don't have to be related in any way, moving this scanning functionality to CopyProcess would result with at least one extra remote stat per CopyJob. This is too expensive.

Cheers, Lukasz

chaen commented 10 years ago

okay, thanks for the explanation! Chris