C++
#include <arc/Logger.h>
#include <arc/URL.h>
#include <arc/UserConfig.h>
#include <arc/data/DataHandle.h>
#include <arc/data/DataMover.h>
int main(int argc, char** argv) {
if (argc != 3) {
logger.msg(
Arc::ERROR,
"Usage: copy source destination");
return 1;
}
logger.msg(
Arc::ERROR,
"Copy failed: %s", std::string(result));
return 1;
}
return 0;
}
Python
12 arc.ThreadInitializer().waitExit()
15 print(
' Usage: copy_file.py source destination')
17 if len(sys.argv) != 3:
22 root_logger = arc.Logger_getRootLogger()
23 stream = arc.LogStream(sys.stdout)
24 root_logger.addDestination(stream)
26 root_logger.setThreshold(arc.ERROR)
30 cfg = arc.UserConfig()
33 source = arc.datapoint_from_url(sys.argv[1], cfg)
35 root_logger.msg(arc.ERROR,
"Can't handle source "+sys.argv[1])
38 destination = arc.datapoint_from_url(sys.argv[2], cfg)
39 if destination
is None:
40 root_logger.msg(arc.ERROR,
"Can't handle destination "+sys.argv[2])
44 mover = arc.DataMover()
50 status = mover.Transfer(source, destination, arc.FileCache(), arc.URLMap())