Here’s another quick tip. If you have a large directory tree (hundreds or thousands of nested levels), and you need to find and delete a set of files from the tree, consider this one-line approach:
cd [target-dir-top-level];for i in `find . -name \*tar.gz`; do rm -f $i; done
Replace my pattern ‘tar.gz’ with one that matches the files you wish to delete.
Tags: freepository, tech-tip, shell scripting

One Comment
And here’s another one-liner:
#find . -name *.tar.gz -exec rm {} \;
Post a Comment