- To: "Meryl" <gnufsf@xxxxxxxxxxxxxxxxxxx>
- Subject: Re: [SLUG] can I make this recursive?
- From: "Ben Stringer" <ben@xxxxxxxxxxx>
- Date: Tue, 28 Jul 2009 07:54:06 +1000 (EST)
- Cc: slug@xxxxxxxxxxx
- User-agent: SquirrelMail/1.4.4-2
> I have a n000b question.
> I found a neat housework script to change case & space but
> I'm wondering is it possible to run it recursively?
> If so where do I put the -r in it?
>
> #!/bin/bash
> for f in *; do
> file=$(echo $f | tr A-Z a-z | tr ' ' _)
> [ ! -f $file ] && mv "$f" $file
> done
>
> cheers,
> Meryl
>
Hi Meryl,
Change "for f in *; do" to be "find . -type f ; do"
This will recursively find all files from the current directory down.
Cheers, Ben