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.

  • 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.
    – Ray
    Jul 11, 2021 at 4:59
  • 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.
    – vanadium
    Jul 11, 2021 at 14:11


You must log in to answer this question.

Browse other questions tagged .