Score:0

Delete files using rsync only after so many days

au flag

Does anyone have a good way to have rsync delete files only after so many days it has been removed from the source?

Kind of like, I delete file x on day one from source, by day 30, the file is then deleted by rsync. This would be something setup when running rsync everyday through crontab.

I see there are delete options but none to delay so many days or seconds.

cn flag
Ray
That's not what rsync is for -- it's for synchronizing two directories (and their subdirectories). If you have the same directory structure locally, you can delete old files using another way, and synchronize that. Would that work? To achieve this, you can try the `tmpreaper` program. I believe you can specify any directory, and not necessarily `/tmp`.
vanadium avatar
cn flag
Alternatively, that is something that can be handled by a Trash-like function at the level of the source directory: delete a file and keep it around for some time in case the user wants to change his mind.
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.