- To: slug@xxxxxxxxxxx
- Subject: Re: [SLUG] can I make this recursive?
- From: jam <jam@xxxxxxxxx>
- Date: Tue, 28 Jul 2009 09:35:16 +0800
- User-agent: KMail/1.10.3 (Linux/2.6.27.23-0.1-default; KDE/4.1.3; x86_64; ; )
On Tuesday 28 July 2009 05:59:39 slug-request@xxxxxxxxxxx wrote:
> > 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
>
> Sorry - ignore my suggestion - it is broken, as it would also capitalise
> the path to the file. I must still be half asleep :)
A whole swag of this sort of thing comes to mind:
for f in `find . -type f`
do
...
done
James