Can someone please let me have a nice shell script to:
1) Identify all folders/sub-folders/files older than 365 days with the exception of one or two folders e.g. named - "common" or "test"
2) Archive (1) above for example in a TAR file
3) Delete all in (1) above
and that's it...
4) In case of some failure, restore (1) above to its original state.
Please note, I tried various Unix commands e.g. find . -mtime +365 -type d ! -name common -exec rm -r {} \;
Please note the using TAR -xvf i.e. to restore the files changes the timestamp of the folders to current timestamp, I want these to be restored back to the original timestamp.
Regards.