'Copy a lot of files - Swift

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



Solution 1:[1]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1