Add creation date or modified date to the name when copy files

What is the problem you are having with rclone?

I can't figured out how to do this (if is possible):

When I use the Rclone copy I want to use the Creation Date or Modified Date of the original file and add it to the name of the copied file.

Example:
sftp: "file.txt" creation date: 01/01/2023
to
bucket: "file-01/01/2023.txt"

I'm on linux.

Which cloud storage system are you using? (eg Google Drive)

Sftp to a s3 bucket

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone --include "*E*.txt" --max-age=2d -vvv --config="./rclone.conf" copy originPath s3Path

hello and welcome to the forum,

with sftp, rclone read the modtime, but not create time.

i think you will need to script that.
--- to get the modtime of a file, rclone lsl
--- and could use https://rclone.org/docs/#suffix-suffix

Hello! Thank you for the welcome and for the answer.

Great! I will try out the rclone lsl.

But the suffix flag only works when the copied file already exist on the destiny (s3 bucket in this case), right? And in this case all the copied files are new in the bucket. Sorry I didn't say that before

i have no not used --suffix in a long time.
why not test on a single file?

I just tested on a single file but it dosn't work when copy new files.

I'm thinking in other solution to achieve this... when copy a file, can I keep the original modtime on the new file?

Then on the backend I will map the files on the bucket and get that modtime.

Check rclone touch. It let you set file modification time to what you want.

Then you would have to script all solution - read modtime from source, copy file, set destination file modtime

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.