1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Add an implementation of copy method to copy files between containers.

This commit is contained in:
Rupak Ganguly 2011-06-16 00:43:14 -04:00
parent 537f4177e6
commit cb2fb6d3ed

View file

@ -29,6 +29,13 @@ module Fog
@directory
end
def copy(target_directory_key, target_file_key)
requires :directory, :key
target_directory = connection.directories.new(:key => target_directory_key)
connection.put_object(target_directory_key, target_file_key, nil, {'X-Copy-From' => "/#{directory.key}/#{key}" })
target_directory.files.get(target_file_key)
end
def destroy
requires :directory, :key
connection.delete_object(directory.key, key)