Hi,
I have been experimenting with s3cmd.

s3cmd get s3://xxx/yyy/zzz.txt /temp/ --preserve
running as root.

It doesn't restore s3cmd-attrs in the Response output I see.

It always goes to the else part of the code snippet below -
if 's3cmd-attrs' in response and cfg.preserve_attrs:
                                        debug("s3cmd-attrs in response and 
--preserve set")
                    attrs = response['s3cmd-attrs']
                    if 'mode' in attrs:
                        os.chmod(deunicodise(dst_file), int(attrs['mode']))
                    if 'mtime' in attrs or 'atime' in attrs:
                        mtime = ('mtime' in attrs) and int(attrs['mtime']) or 
int(time.time())
                        atime = ('atime' in attrs) and int(attrs['atime']) or 
int(time.time())
                        os.utime(deunicodise(dst_file), (atime, mtime))
                    if 'uid' in attrs and 'gid' in attrs:
                        uid = int(attrs['uid'])
                        gid = int(attrs['gid'])
                        os.lchown(deunicodise(dst_file),uid,gid)
                elif 'last-modified' in response['headers']:
                    last_modified = 
time.mktime(time.strptime(response["headers"]["last-modified"], "%a, %d %b %Y 
%H:%M:%S GMT"))
                    os.utime(deunicodise(dst_file), (last_modified, 
last_modified))
                    debug("set mtime to %s" % last_modified)

Am I using it correctly or missing something?


Thanks
_Kiran


_______________________________________________
S3tools-general mailing list
S3tools-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/s3tools-general

Reply via email to