Skip to content

Instantly share code, notes, and snippets.

@douggrubba
Created December 6, 2011 20:58
Show Gist options
  • Save douggrubba/1439969 to your computer and use it in GitHub Desktop.
Save douggrubba/1439969 to your computer and use it in GitHub Desktop.
"rename" s3 object
$old_dir = getcwd() . '/projects/' . $old_url_name;
$new_dir = getcwd() . '/projects/' . $new_url_name;
// Instantiate the class
$s3 = new AmazonS3();
$s3->disable_ssl();
$cp_resp = $s3->copy_object(
array( // Source
'bucket' => S3BUCKET,
'filename' => $old_dir
),
array( // Destination
'bucket' => S3BUCKET,
'filename' => $new_dir
)
);
$rm_resp = $s3->delete_object(S3BUCKET, $old_dir);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment