Linux script to delete a type of file under multiple directories
Environment
OEL 5.5x64 bit
Problem
There are many old ".txt" files to be deleted under a download directory, which contains many sub-directories, like
$ cd /download
$ ls -d
20090601 20090602 xxx
20090701 20090702 xxx
xxxx
Solution
$ for i in `ls -d 20090[678]*`; do rm $i/*.txt; done
Labels: Linux, shell script
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home