Score:0

NAS rsync - delete files from destination which are not on source and are 1 week old

mx flag

I have hyperbackup running from source NAS to destination NAS with the below settings

  1. Backup type - Rsync
  2. Options - reserve backup file at destination
  3. With this i have a backup method that results in a file/fodler structure in the 2nd NAS, withut the hyperbackup proprietary format or tools

I have the below cronjob on source NAS via task schedule which deletes files on the destination NAS which are not present in source NAS.

rsync -avh --delete /path/to/source user@wan_ip:/path/to/destination

I want to modify the cron job so that it deletes files from destination which are not present on source and 1 week old. something like:

rsync -avh --delete(1 week old) /path/to/source user@wan_ip:/path/to/destination

Is there a way to do this?

The source and destination NAS both have multiple folders on which this Job has to run.

Score:0
in flag

I don't see any options for rsync that would do this per se, but you could try a two step approach.

You can add the -b parameter too your rsync call, which would cause it to rename the files with a backup extension instead of deleting them.
Then you could run a find afterwards that looks for backup files older than 1 week and deletes them.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.