0

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

Rob Napier
  • 286,113
  • 34
  • 456
  • 610
jejedu67
  • 11
  • 5
  • Somebody know ? – jejedu67 May 02 '22 at 20:19
  • Have you thought about creating a loop and iterate through each object in that list to copy all of them? I'm not sure if swift has built-in capabilities to copy lots of files. Or check out [rclone](https://rclone.org/swift/), it could do the job, I haven't tried that myself. – eblock May 03 '22 at 14:34

1 Answers1

0

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.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
  • Ok thank you. An easy solution is to open 2 Cyberduck Windows and drag and drop to the new container, but it's the same problem as that when uploading directly from my computer, it is entirely dependent on my internet connection, since the transfer is obviously not done from the container to the container, but from the container to my PC and directly from my PC to the new container. – jejedu67 May 18 '22 at 16:32
  • So ... write a script. It isn't rocket science to do it. – Stephen C May 18 '22 at 23:53