Copy a lot of files - Swift

629 Views Asked by At

I own Object Storage containers at OVH. I found how to copy a file from one container to another:

swift copy -d /"Destination container" "Initial container" "File"

It works, but I want to copy hundreds of files. Do you know how to copy a lot of files that are in a folder ?

Thank you

1

There are 1 best solutions below

2
Stephen C On

The OpenStack Swift API doesn't have methods to copy multiple objects. The PUT, GET and COPY methods all operate on single objects.

So you have to loop over a listing of the source container, and copy each file one at a time. You can do this using a shell script and the swift command, or using one of the Swift API libraries and some custom code (e.g. in Python).

Alternatively you could use rclone (link) or potentially cyberduck (link). These tools apparently don't use the COPY method so the copy will entail extra transfer steps and may take longer overall than if you wrote a script to do the job.