Advertisement
Guest User

Untitled

a guest
Aug 31st, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. import pyrax
  2.  
  3. pyrax.set_setting("identity_type", "rackspace")
  4. pyrax.set_default_region('ORD')
  5. pyrax.set_credentials('{username}', '{api-key}')
  6.  
  7. cf = pyrax.cloudfiles
  8.  
  9. src_container = cf.get_container("{src-container}")
  10. dest_container = cf.get_container("{dest-container}")
  11.  
  12. print 'Src: ' + src_container.name + ' (' + str(src_container.object_count) + ' objects)'
  13.  
  14. objects = src_container.get_objects(full_listing=True)
  15.  
  16. copied = 0
  17.  
  18. for object in objects:
  19. if object.content_type == 'application/directory':
  20. print 'skipping directory: ' + object.name
  21. else:
  22. print 'copying (' + str(copied + 1) + ' of ' + str(src_container.object_count) + '): ' + object.name
  23. cf.copy_object(src_container, object.name, dest_container)
  24. copied += 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement