I am regularly running 'rclone copy' to copy files from local folders to a Google Cloud Storage bucket.
Each local folder contains 1 week worth of specific log files (rolling delete after 1 week).
In the GCS bucket, I have a hierarchical folder structure similar to:
bucket/log_type/owner/date/
I supply the /log_type/owner prefixes manually as shown in the rclone command below. The date sub-folder should be computed automatically from the file creation date, and added as a prefix to each file encountered in the source directory. Is there such an option in rclone?
What is your rclone version (output from rclone version)
rclone v1.51.0
os/arch: linux/amd64
go version: go1.13.7
Which OS you are using and how many bits (eg Windows 7, 64 bit)
ubuntu 18, 64 bits
Which cloud storage system are you using? (eg Google Drive)
GCP Storage buckets
The command you were trying to run (eg rclone copy /tmp remote:tmp)
rclone: Version "v1.51.0" starting with parameters ["rclone" "copy" "/my_source_dir" "my_remote:my_bucket/log_type/owner/" "-vv"]
if you copy an entire directory to a new folder in the remote, then you have duplicates in each new folder.
perhaps you can use sync and --backup-dir. rclone sync /my_source_dir my_remote:my_bucket/pictures/current --backup-dir=my_remote:my_bucket/pictures/current_date/"
I'd probably use some variant of $(date) in the script that does the transfer which doesn't quite get the creation date into the file name but it is close...
My current hack is to sync every midnight with the --max-age 24h flag, to get the correct binning by date.
However, if a sync job fails, the failed data then needs to be resynced manually.
As the perfect solution does not yet exist, I could envision to have 7 sync jobs one after the other, each filtering the data in the source folder for one specific date, and prefixing the encountered files with that date. Since I have max. 1 week of data, that still seems doable.
Update for precision: you can't rename filenames to contain forwardslashes --> I recreated the lowest level of desired folder structure (date) locally.