sh Scripting - String Manipulation

Drew Tomlinson drew at mykitchentable.net
Thu Oct 13 16:07:00 PDT 2005


I'm working on a script that reads a directory using 'find' and its 
'-exec' primary to create a symlink to the file.  So for example, I have 
the following command:

find /multimedia/Pictures -iname "*.jpg" -print

This command returns a bunch of filenames.  Here's an example of one:

/multimedia/Pictures/2005 Kimberly & Rich/IMG_1210.JPG

What I'd like to is get '-exec' to run this command:

ln -s "/multimedia/Pictures/2005 Kimberly & Rich/IMG_1210.JPG" "2005 
Kimberly & Rich/IMG_1210.JPG"

What is the best way to manipulate this string?  And then what is the 
right syntax for -exec?  I'm an extreme newbie when it comes to shell 
scripting.  Will this work?  Are the better ways to do this than using 
"find".

Thanks for your help,

Drew

-- 
Visit The Alchemist's Warehouse
Magic Tricks, DVDs, Videos, Books, & More!

http://www.alchemistswarehouse.com



More information about the freebsd-questions mailing list