Do anyone know some good way to delete files on remote server that are older than X days using just SCP/SFTP?
Sure I can write some script on perl etc but I feel it's overkill.
Any UNIX way?
Oneliner?
Separate utility?
Thanks
P.S.
The task is to delete some outdated backup files.
Best Answer
This question is very old but I still wanted to add my bash only solution as I was just searching for one when I came here. The grep tar in the listing command is just for my own purpose to list only tar files, can be adapted of course.
This deletes all tar files in the given directory except the last 7 ones. It is not considering the date though but if you only have one backup per day it is good enough.