Moving files
Bob Bell
bobbell at zk3.dec.com
Mon Jan 6 17:27:59 EST 2003
On Mon, Jan 06, 2003 at 04:31:57PM -0500, Kevin D. Clark <kclark at cetaceannetworks.com> wrote:
> I have yet to see anybody else post code that implements these features
> (recursing + renaming the directories with names containing spaces).
Just because that sounded like a challenge, how about this for
a non-Perl solution:
$ find . | sort -r | while read f; do b=$(basename "$f"); d=$(dirname "$f"); \
[[ $b != ${b/ /} ]] && mv "$f" "$d/${b// /_}" ; done
--
Bob Bell <bobbell at zk3.dec.com>
-------------------------------------------------------------------------
"Parentheses in Perl are like shoes in the Caribbean."
-- Larry Wall, creator of the Perl programming language
More information about the gnhlug-discuss
mailing list