Forum Moderators: coopster

Message Too Old, No Replies

Mass rename of pictures

within a folder...

         

omoutop

8:08 am on Apr 18, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



hi to all...

I need your wisdom guys and girls!

I have a folder with photos regarding products, approximately 5000 of them, I need to create a script that will get the filename for each one photo and rename it, or better yet add a sufix at the end like _small or _large...

for instanse the photo:
345-987PW.jpg has to be renamed to 345-987PW_s.jpg

Ay help will be appreciated!...

4hero

10:49 am on Apr 18, 2006 (gmt 0)

10+ Year Member



Hello,

This can be done very easily with Adobe Photoshop 7+.

My instructions presume that all the files you want to rename are in one folder.

To do this follow these steps (For PC only):

  • Open Photoshop
  • Open File Browser (Shift Ctrl O)
  • Select your source folder on the left
  • Press Ctrl A to select all your files on the right
  • Right click on one of the images
  • Select Batch Rename

    In File Naming you will see 6 dropdown boxes

  • First dropdown should have document name (change to DOCUMENT NAME if you want the capitals in the file name to remain)
  • Second dropdown type in _sm (this will add _sm to all your images)
  • Third dropdown select extension from the dropdown
  • Press OK

    Now go put the kettle on, make yourself a cup of tea and enjoy, while photoshop does all the hard work for you :)

  • Habtom

    11:15 am on Apr 18, 2006 (gmt 0)

    WebmasterWorld Senior Member 10+ Year Member



    If you still want to do it via PHP, your syntax could go something like:

    $files1 = scandir($dir); //this holds all your file names

    and use the rename function like

    rename($files1[0], withthis);

    I haven't tried but it shall work.

    Habtom

    omoutop

    11:20 am on Apr 18, 2006 (gmt 0)

    WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



    Thank you very very much both of you for your answers and feedback, i will try both ways and report back soon enough, take care

    adb64

    12:39 pm on Apr 18, 2006 (gmt 0)

    10+ Year Member



    I use Irfanview ( [irfanview.com...] ) or Eyebatch ( [atalasoft.com...] ) to do batch conversions.

    Regards,
    Arjan

    dreamcatcher

    1:39 pm on Apr 18, 2006 (gmt 0)

    WebmasterWorld Senior Member 10+ Year Member



    I use a bulk file renaming program. Great little freebie.

    [bexonsoft.com...]

    dc

    omoutop

    11:37 am on Apr 19, 2006 (gmt 0)

    WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



    thank you all for your feedback, 4hero's solution using photoshop was just fine although I do believe that all ideas provided here would be a good solutions, thank you very much all of you

    hakre

    4:30 pm on Apr 24, 2006 (gmt 0)

    WebmasterWorld Senior Member 10+ Year Member



    keep in mind that opening JPG files and saving them again as JPG will result in image loss. in case you only need to rename your files they should only be renamed not resaved.