Hi all. I am trying to set up archiving of directories, such that I keep every directory made in the past week, but just one directory per week beyond that. Using the find command, I can easily delete everything more than one week old, but can not figure out how to save one.
Each directory contains a single zip file. I'd prefer to keep the one with the largest zip file, but this is not necessary. If someone can tell me how I can keep just one directory, regardless of criteria, I would be greatly appreciative.
I realize that this could probably be done by hand, but a zip file and directory is created ~every 30 minutes, so it would be rather tedious.
Thanks for any help you can provide.
EDIT: This archiving is currently done (deleting everything more than a week old) in a shell script that is called by the program. This script creates and moves the zip file from a bunch of jpg's. Hence, I figured this was the correct sub-forum. If not, let me know and I will be glad to move it.
Sorry, might be misleading, as find can only show files compared to some size, what might give you still too many files, instead of 1 for the largest. Here is a bit lengthy explanation, how you could handle this and implement in the script you already have:
That is quite helpful, but seems to be missing the final step. Once I pick out that file, how can I execute any other command on it? I am thinking I just want to 'touch' that file and make the date far enough in the past that the script will cease caring about it. Thanks again.