Date: Sat, 15 Oct 2005 02:29:16 +0300 From: Giorgos Keramidas <keramida@ceid.upatras.gr> To: Drew Tomlinson <drew@mykitchentable.net> Cc: Paul Schmehl <pauls@utdallas.edu>, freebsd-questions@freebsd.org Subject: Re: sh Scripting - String Manipulation Message-ID: <20051014232916.GA49272@flame.pc> In-Reply-To: <434FEF24.4050803@mykitchentable.net> References: <434EE80D.2010103@mykitchentable.net> <0D55CDDCD0D6445B3FF1FA6B@Paul-Schmehls-Computer.local> <434FD118.60109@mykitchentable.net> <72CE9870C77DFB8443C76023@utd59514.utdallas.edu> <434FEF24.4050803@mykitchentable.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On 2005-10-14 10:47, Drew Tomlinson <drew@mykitchentable.net> wrote:
> On 10/14/2005 9:27 AM Paul Schmehl wrote:
> >for files in /my/dir/for/files/*.jpg
> >do
> >NEWFILES=`$files | cut -d'/' -f 6`
> >ln -s $files /new/dir/for/pics/$NEWFILES
> >done
>
> But there is still one problem. This won't search recursively which is
> why I was using find. However if I start with
>
> "for files in `find /multimedia -iname "*.jpg" -print"
>
> this would probably work. I'll try it and see. Or is there some
> other (better) way to search for files recursively?
find(1) is usually nice. One thing you may want to be careful about
with find in a for loop is that filenames with whitespace are probably
going to end up in a huge mess. It may be better to use something like
the following:
find /multimedia -iname '*.jpg' | \
while read fname ;do
# Manipulate ${fname}
done
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051014232916.GA49272>
