We have a ubuntu server at my workplace set up as a backup box to store customers' files when they need a backup restore. We have a main folder named 'backup' and inside we create folders for each client based on the client's name, eg "jdoe" for John Doe. We then place their documents, etc. into that folder. The backup box is updated once a month, but otherwise it is not connected to the internet for security purposes.
We're looking to create a cron job to delete the folders after 3 days, based on each folder's creation date (I'm assuming this is also the last modification date). We want crontab to look at the client-name folders inside the 'backup' directory, and NOT the contents inside the client-name folders to decide the date. In other words, we want the folders deleted with their contents, making sure that only the last modification date of the client-name folder is used to determine when to delete. We've had bad cron jobs in the past that would delete files inside client-name folders prematurely, leaving the folders. Any help would be greatly appreciated.
Also, let me know if a php script would do a better job with this.
Bookmarks