0

I am creating bash script to store backup files on Rackspace (mosso). For now i am done with uploading and deleting files from containers.

Next step is to remove files older than two weeks (remove from container).

The questions is how to get metadata from object? e.g on uploading i am creating metadata for objects (Created Date) to store timestamp.

  1. I have some files on my hosting (different than cloud): dbbackup.tar.gz dbbackup2.tar.gz dbbackup3.tar.gz
  2. running cron to upload that files into Rackspace Files -cron:
    1. delete old files (older than 2 weeks)
    2. upload new backup files
    3. add metadata (Created Date, Content Type)

The issue is in 2.1 (Deleting) i don't see file created date in Rackspace Cloud interface and i don't see it also in http headers.

I need that data to check expiration date for the given file. So the question is HOW TO GET MY CUSTOM ADDED METADATA to use in calculations ?

Thanks

minnur
  • 115
  • 7

1 Answers1

1

I think what you're looking for is to use a HEAD on the object to get the X-Object-Meta-CreatedDate (sic) custom info that you added in 2.3. See page 23 of the API manual:

http://www.rackspacecloud.com/files/cf-devguide-20090812.pdf

===
Request

The only required header to be sent in the request is the authorization token. Sample request:

HEAD /<api version>/<account>/<container>/<object> HTTP/1.1
Host: storage.clouddrive.com
X-Auth-Token: eaaafd18-0fed-4b3a-81b4-663c99ec1cbb

Response

No response body is returned. Metadata is returned as HTTP headers. A status code of 204 (No Content) indicates success, status 404 (Not Found) is returned when the Object does not exist.

Sample response:

HTTP/1.1 204 No Content
Date: Thu, 07 Jun 2007 20:59:39 GMT
Server: Apache
Last-Modified: Fri, 12 Jun 2007 13:40:18 GMT
ETag: 8a964ee2a5e88be344f36c22562a6486
Content-Length: 512000
Content-Type: text/plain; charset=UTF-8
X-Object-Meta-Meat: Bacon
X-Object-Meta-Fruit: Bacon
X-Object-Meta-Veggie: Bacon
X-Object-Meta-Dairy: Bacon

===

I think your question is better for Stack Overflow than Server Fault...

  • You're welcome, hey I learned a little something as well. :) You should mark this question as accepted (solved) so that it disappears off the unanswered stack... –  Jan 13 '10 at 18:54