Help

HFE Signs

Business Member
  • Business Listing
    Hi Everyone,

    Can anyone help me with some script or how I can do the below?

    I've got 1274 images, all the same image but different file names (the website renames them so they are unique files but same content).

    I need to change this image but keep the existing file names, so I can upload in bulk.

    Please can one of you clever IT wizards help me?

    Thanks you so much
     

    HFE Signs

    Business Member
  • Business Listing
    I could write a python script for you to run, but I'm wondering what your website architecture is that you have 1274 of the same image stored as separate files.

    Can you not rearchitect the site to use the same file?
    I'm not sure about the site structure as I'm not a developer, I have limited access to the back end and can only add and edit products, the rest is done automatically.

    How much would you charge to help me with this?

    Thank you
     
    Upvote 0

    DefinitelyMaybeUK

    Free Member
    Jan 12, 2021
    297
    72
    If it's windows, then a simple batch file will do it, if I've understood you correctly.

    Put a copy of your existing images in a folder called "old", put the new master image at the level above the "old" and paste the following into a text file e.g. notepad and save as "hfe_rename.bat" or similar, at the same location as the master image:

    if not exist new mkdir new
    cd old
    for %%i in (*.jpg) do copy ..\master.jpg ..\new\%%i
    pause


    Next, either open up a "Command" prompt or "Terminal" as they call it these days and change directory to the batch file location and run your saved batch file OR double click the .bat file from windows explorer - any messages will be shown in the window. This will create a new folder called "new" if it doesn't exist and then copies all the old filenames using the same "master.jpg" image. This assumes all you files are ".jpg" extension, if not, then this will need some tweaking.
     
    Upvote 1

    fisicx

    Moderator
    Sep 12, 2006
    46,740
    8
    15,405
    Aldershot
    www.aerin.co.uk
    Whatever methods you employ to replace the images you will need access to the folder on the server. This is normally done via your control panel. If you don’t have a login to the control panel then you need to ask whoever manages your site to do it for you.

    That being said, needing 1274 copies of the same image suggests there is something amiss with your site.
     
    Upvote 0

    HFE Signs

    Business Member
  • Business Listing
    If it's windows, then a simple batch file will do it, if I've understood you correctly.

    Put a copy of your existing images in a folder called "old", put the new master image at the level above the "old" and paste the following into a text file e.g. notepad and save as "hfe_rename.bat" or similar, at the same location as the master image:

    if not exist new mkdir new
    cd old
    for %%i in (*.jpg) do copy ..\master.jpg ..\new\%%i
    pause


    Next, either open up a "Command" prompt or "Terminal" as they call it these days and change directory to the batch file location and run your saved batch file OR double click the .bat file from windows explorer - any messages will be shown in the window. This will create a new folder called "new" if it doesn't exist and then copies all the old filenames using the same "master.jpg" image. This assumes all you files are ".jpg" extension, if not, then this will need some tweaking.
    Thanks so much, this worked perfectly :)
     
    • Like
    Reactions: DefinitelyMaybeUK
    Upvote 0

    Latest Articles