How to copy and after delete source files that are 1h old. (Amazon Drive)

Would you help me out seting up the commands to:
A) copy from source to destination.
B) delete files on source when they are older then 1h and have a match on destination.

Atm Iam running in crontab /usr/sbin/rclone move /home/storage/.media-local/ acd-rclone:/encrypted -v --transfers=100 --checkers=50 --ignore-times --ignore-size --ignore-existing --delete-after --log-file=/var/log/flix/rclone.log

But I can encounter problem if file is being copied to source (or being unpacked) when the rclone runs, so i would prefer to copy first and delete after.

Hopefully thats possible as for alternative I could use rclone copy and another script that would delete few days ( instead of 1h) old files, just to be safe they were uploaded during that time. that time.

That doesn’t look too bad. Not sure why you are using -ignore-times --ignore-size --ignore-existing - I wouldn’t have thought you needed any of those. When rclone does a move it checks to see whether the file is the same src and dst and moves it if not. You could possibly add --checksum instead of those.

You could try adding --min-age 1h to only transfer files which are a minimum of 1 hour old.

1 Like

Great suggestion dunno how i missed the filter.

Will the files be deleted on source if they are not being copied ?

I don’t think so, but suggest you test first with --dry-run :slight_smile: