When I copy a file from Linux to an AWS bucket the Modtime is the last modification time of my file on Linux. I would like change the Modtime during upload to AWS to the time when the file was uploaded to the bucket.
( similar as when I do the copy of the file to the bucket with the S3 Explorer from AWS).
This is what I have done:
rclone copy -vv test1.txt s3:newsflash2
after the upload the mod date is the old linux date: 2021-02-25
rclone lsf --format "tsp" s3:testbucketnils --include=test2.txt
2021-02-25 11:44:00;51000;test1.txt
Is there a flag that I can use in order to change the moddate during upload to AWS to date when the transfer took place (upload date to the bucket)?
I tried with all kinds of flag, but without any luck:
--update --refresh-times
--update --use-server-modtime
..
What is your rclone version (output from rclone version)
rclone v1.57.0
os/version: amazon 2018.03 (64 bit)
os/kernel: 4.14.238-125.422.amzn1.x86_64 (x86_64)
os/type: linux
os/arch: amd64
go/version: go1.17.2
go/linking: static
go/tags: none
Which cloud storage system are you using? (eg Google Drive)
AWS S3
The command you were trying to run (eg rclone copy /tmp remote:tmp)
You have the right flag but provided no actual logs or whatnot to help you out
--update --use-server-modtime
Uses no extra transactions.
Modification time becomes the time the object was uploaded.
For many operations this is sufficient to determine if it needs uploading.
Using --update along with --use-server-modtime, avoids the extra API call and uploads files whose local modification time is newer than the time it was last uploaded.
Files created with timestamps in the past will be missed by the sync.
rclone sync --update --use-server-modtime /path/to/source s3:bucket
This is the log file for the command:
rclone copy -vv --update --use-server-modtime test1.txt s3:newsflash2
$ rclone copy -vv --update --use-server-modtime test1.txt s3:newsflash2
2021/12/08 21:47:00 DEBUG : rclone: Version "v1.57.0" starting with parameters ["rclone" "copy" "-vv" "--update" "--use-server-modtime" "test1.txt" "s3:newsflash2"]
2021/12/08 21:47:00 DEBUG : Creating backend with remote "test1.txt"
2021/12/08 21:47:00 DEBUG : Using config file from "/home/stonebranch/.config/rclone/rclone.conf"
2021/12/08 21:47:00 DEBUG : fs cache: adding new entry for parent of "test1.txt", "/home/stonebranch/demo/out"
2021/12/08 21:47:00 DEBUG : Creating backend with remote "s3:newsflash2"
2021/12/08 21:47:01 DEBUG : test1.txt: Need to transfer - File not found at Destination
2021/12/08 21:47:01 DEBUG : test1.txt: md5 = 878eaf2d901370e03056b8da9e0d7cc9 OK
2021/12/08 21:47:01 INFO : test1.txt: Copied (new)
2021/12/08 21:47:01 INFO :
Transferred: 49.805 KiB / 49.805 KiB, 100%, 0 B/s, ETA -
Transferred: 1 / 1, 100%
Elapsed time: 1.1s
2021/12/08 21:47:01 DEBUG : 5 go routines active
$ rclone lsf -vv --format "tsp" s3:newsflash2 --include=test1.txt
2021/12/08 21:47:17 DEBUG : rclone: Version "v1.57.0" starting with parameters ["rclone" "lsf" "-vv" "--format" "tsp" "s3:newsflash2" "--include=test1.txt"]
2021/12/08 21:47:17 DEBUG : Creating backend with remote "s3:newsflash2"
2021/12/08 21:47:17 DEBUG : Using config file from "/home/stonebranch/.config/rclone/rclone.conf"
2021/12/08 21:47:18 DEBUG : bigdata.png: Excluded
2021/12/08 21:47:18 DEBUG : index.html: Excluded 2021-02-25 11:44:00;51000;test1.txt
2021/12/08 21:47:18 DEBUG : 4 go routines active
The mod date is still the date of file create in linux from February 25th.
I would like the modedate to be 2021/12/08 21:47:01 - the date when the file was uploaded to AWS S3
Thanks for all the infos. So it seems it is not possible what I wanted to achieve.
My goal was to list in my AWS bucket all files which have been uploaded after a certain date. I thought I could use the modtime for this. This will not work, because it seems I cannot update the modtime. Reclone will always show the Linux last modification time ( e.g. the time when I created the file on my Linux server).
The strange think is that if I upload the same file with my Aws explorer ( or boto3) the mod time is the date when I uploaded the file to Aws and not the Linux creation date. This is why I thought it must also be possible with reclone copy to do this.