On 10/14/2005 9:27 AM Paul Schmehl wrote:

--On Friday, October 14, 2005 08:39:04 -0700 Drew Tomlinson <[EMAIL PROTECTED]> wrote:



That's a good idea (and something else I never thought of) if I wanted
all the files, not just the *.jpg files.  And as I'll explain below, I
intend to expand this script to work with additional directories where I
might just want the *.mp3 or the just the *.avi, *.mpg, etc.  My thought
was to build a script and run it through cron to keep the symlinks
updated.

OK.  Then I think you're going about it the wrong way.

This would accomplish what you want without having to do any string manipulation, and without having to generate a list of files. The for loop does all that for you.

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?

Thanks again,

Drew
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to