- 论坛徽章:
- 0
|
in general, if you want to \"permanently save\" something, you\'d better put them somewhere else, if not on a diff fs, at least in a diff directory. relying on tricks in a script not to remove something is tricky. one day you might regret when you find out the script is not 100% bullet-proof.
having said that, try something like this:
cd <target directory>
/bin/rm -rf `find . |grep -v ^.\\/<sub directory>`
here is the idea.
find . will find everything under . and use grep -v to filter out those from the sub directory you want to save, and rm will remove them.
in find, add whatever criteria you want, e.g., mtime +7 |
|