Is their a script that I can put in a directory of images on my webserver, that will allow me to batch re-name them all?
I can suggest a few programs for download for windows that would basically do that. Off the top of my head, I don't know of a mass file renamer script.
Thanks for the reply, but im trying to do it so I dont have to reload all my pictures to the server. Thanks again
Write yourself a script You can use directory functions http://www.php.net/manual/en/ref.dir.php . I beleive it's a less than half hour work.
If the OS is Unix based, there are already all sorts of tools for that. Is there some pattern to how you want them renamed? I'd be happy to help you script it then.
Whoa I wasn't expecting individual help on it, but that's great if its something simple. (yes its on linux) I'm at work right now so I can't start with the PHP scripting, but basically on my photography site okinawa-photography , the pictures on the server are all named with camera's default naming, ie. DSCP0001. Instead of uploading all new pictures again, I would just like to maybe rename them according to the directory they are in (so if someone searched for "okinawa beach" they would be listed) So for example something like: okinawa_beach_daytime_001.jpg. Easy enough to implement?
Ok, see I'm currently in a directory called okinawabeach that contains some photos called DSCP0001.jpg DSCP0002.jpg etc. mrspanky@online-42:~/phototest/okinawabeach$ ls DSCP0001.jpg DSCP0003.jpg DSCP0005.jpg DSCP0007.jpg DSCP0002.jpg DSCP0004.jpg DSCP0006.jpg DSCP0008.jpg So if I do: mrspanky@online-42:~/phototest/okinawabeach$ for i in * ; do mv $i okinawa_beach_daytime_`echo $i | awk -FDSCP '{print $2}'`; done The result is this: mrspanky@online-42:~/phototest/okinawabeach$ ls okinawa_beach_daytime_0001.jpg okinawa_beach_daytime_0005.jpg okinawa_beach_daytime_0002.jpg okinawa_beach_daytime_0006.jpg okinawa_beach_daytime_0003.jpg okinawa_beach_daytime_0007.jpg okinawa_beach_daytime_0004.jpg okinawa_beach_daytime_0008.jpg
Basicly all you go to do is change to the directory and run for i in * ; do mv $i okinawa_beach_daytime_`echo $i | awk -FDSCP '{print $2}'`; done Code (markup): You can ofcouse change okinawa_beach_daytime to something else in that line - you could also change it to correspond to the directory you are currently in but this is just a fast sollution. If you need to change it to be more automated, just let me know. Oh and ofcouse also change awk -FDSCP to something else if your files doesn't start with DSCP.
Allright - this uses the current work directory: for i in * ; do echo mv $i `pwd | sed -e "s/.*\/\([^/]*\)$/\1/"`_`echo $i | awk -FDSCP '{print $2}'`; done Make a copy of the directory and give it a test run first
Thank you so much for the excellent help. I will try this as soon as I get home. I should have no problems with your great explanation