Copy and Delete in one scrypt

I have below scrypt witch copy my backup to Onedrve. Everythink is works but now I would like to rebuild scrypt to add option delete folder with data older than 31 days. What do you think about add this under rclone copy line?
rclone delete OneDrive:Backups --min-age 31d -v

if pidof -o %PPID -x “”; then
exit 1
rclone copy /media/backup_data/ OneDrive:Backups/date +"%Y-%m-%d"

hello and welcome to the forum,

that should work.
best to test using --dry-run, as that will log what rclone would do, without deleteing any files.

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