Dave Ihnat wrote:
On Mon, Dec 01, 2008 at 04:22:16PM -0500, Bill Davidsen wrote:
That won't work if filenames contain blanks, something I fight daily.
For blanks, do something like "find . -name "*log" -exec rm -fr "{}" ;
Of course, that's assuming the name pattern is what you want. You can also specify if you want only files, only directories, or both.
I find that "find ... -exec" is very limited. For anything more complicated than a single command, it usually seems to fail (or else I don't know how to use it properly). It'd really be nice if ls had an option to quote the output. But there is this:
IFS=' '; for i in $(ls -1d *.log); do echo $i; done
Note that there must be no space after the first single quote.
rh