Azure / blobxfer

Azure Storage transfer tool and data movement library
MIT License
151 stars 38 forks source link

Is there an option to set file date on local disk the same as the one on Azure blobs? #81

Closed laurentvm closed 6 years ago

laurentvm commented 6 years ago

Feature Request Description

Describe Preferred Solution

A clear and concise description of what you want to happen.

Describe Alternatives Considered

A clear and concise description of any alternative solutions or features you've considered.

Additional Context

Add any other context or screenshots about the feature request here.

alfpark commented 6 years ago

No, there is no such option and it is unlikely such an option will be added as there's no built-in way to do this and it's very OS specific with "workarounds." If you need this functionality, you'll likely need to script listing your blobs and then use touch or powershell to set the dates.

laurentvm commented 6 years ago

Can't you set the date with:

https://docs.python.org/3/library/os.html#os.utime

and get the date from the blob with this?

bucket = storage_client.get_bucket(bucket_name)
    blob = bucket.get_blob(blob_name)

    print('Blob: {}'.format(blob.name))
    print('Bucket: {}'.format(blob.bucket.name))
    print('Storage class: {}'.format(blob.storage_class))
    print('ID: {}'.format(blob.id))
    print('Size: {} bytes'.format(blob.size))
    print('Updated: {}'.format(blob.updated))
    print('Generation: {}'.format(blob.generation))
    print('Metageneration: {}'.format(blob.metageneration))
    print('Etag: {}'.format(blob.etag))
    print('Owner: {}'.format(blob.owner))
    print('Component count: {}'.format(blob.component_count))
    print('Crc32c: {}'.format(blob.crc32c))
    print('md5_hash: {}'.format(blob.md5_hash))
    print('Cache-control: {}'.format(blob.cache_control))
    print('Content-type: {}'.format(blob.content_type))
    print('Content-disposition: {}'.format(blob.content_disposition))
    print('Content-encoding: {}'.format(blob.content_encoding))
    print('Content-language: {}'.format(blob.content_language))
    print('Metadata: {}'.format(blob.metadata))

I used cloudberry to sync manually and it does set the right time to file on windows.

alfpark commented 6 years ago

Retrieving the LMT for a blob is not an issue. It's setting the date of the file on local storage, which is OS dependent. Your original request did not specify modified time, it asks for setting the "file date on local disk".

alfpark commented 6 years ago

Feature request #82 opened.