ruby - Delete a huge amount of files in Rackspace using fog -


I have millions of files in my rackspace files. I would like to delete one part of them, instead of removing one, Passing the list, which is very slow, is there any way to do this with fog? Right now, I have a script to delete every file, but it would be nice to do something with better performance.

  connection = fog :: storage.new ({: Provider = & gt; Rackspace: rackspace_username = & gt; "xxxx" ,: rackspace_api_key => "xxxx" ,: Rackspace_region = & gt ;: IAD}) dir = connection.directories.select {| D. D.key == "my_directory"}. First CloudFileModel.where (duplicate: 1) .each do | Record | F = record.file.gsub ("/", "") dir.files.destroy (f) Rescue Nile puts the "deleted # {record.id}" end  

Yes, you can do it with it.

Deletes many objects or containers with the same request.

To remove objects from a container, container can be provided and should be a head of the object names within the object_names container.

To remove items from many containers or to remove containers, container should be zero and all object_names container's name Should be done with the prefix.

The containers should be blank when removed, the object_names is processed in the given order, so the object within a container must be listed first to free the container.

One request can remove 10,000 objects. The server will respond with 200 OK for all requests response.body should be inspected for the actual result

example:. Delete objects from a container

  object_names = ['object', 'another / object'] conn.delete_multiple_objects ('my_container', object_names)  

Remove objects from many containers

  object_names = ['container_a / object', 'container_b / object'] conn.delete_multiple_objects (zero, object_names) / Code>  

Delete all the contents of a container and its contents

 object_names = ['my_container / object_a', 'my_container / object_b' , 'My_container'] conn.delete_multiple_objects (zero, object_names)  

Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -