Page 1 of 1

Hopefully a straightforward one?

Posted: 14 Sep 2021 02:09
by Kaarthuul
Hi all,

I get sent a zip file from my design team that contains images in several different languages. Each language has its own folder and in that folder is a folder called "images"

i.e. EN/images/
FR/images/
SE/images/ etc.

Once extracted I need a batch file to speed up the process of getting these images to the correct place.

For each folder I have to rename the images folder to the equivalent language (usually the same but for some reason Sweden is different)

i.e. EN/en
FR/fr
SE/sv

These renamed folders then have to be uploaded to a numbered folder on a network drive (filecopy) which then uploads these images to the webserver.

I need to capture the 4 digit number from the user create the folder using that number i.e. Y:\Images\email\1234 and then copy all the renamed folders above into it. Ideally with a pause between each folder as the filecopy upload can be temperamental.

Hope you can help, info file attached, thanks.

Re: Hopefully a straightforward one?

Posted: 14 Sep 2021 10:05
by Aacini
You'll get more feedback if you add details and examples to your question. Did you read the very first post in this forum?

Antonio

Re: Hopefully a straightforward one?

Posted: 14 Sep 2021 10:25
by Squashman
Kaarthuul wrote:
14 Sep 2021 02:09
For each folder I have to rename the images folder to the equivalent language (usually the same but for some reason Sweden is different)

i.e. EN/en
FR/fr
SE/sv
That looks like you are renaming the Language Folder and not the images folder.

Re: Hopefully a straightforward one?

Posted: 14 Sep 2021 11:33
by Kaarthuul
I thought I had explained it quite clearly, I shall simplify it even more for you:

Please input number: (user inputs a number) e.g. 1234

Make folder Y:\Images\email\1234

rename folder "images" in the EN folder to en and copy this en folder and its contents to the newly created 1234 folder

rename folder "images" in the FR folder to fr and copy this fr folder and its contents to the newly created 1234 folder

rename folder "images" in the SE folder to sv and copy this sv folder and its contents to the newly created 1234 folder

etc. etc. etc. for 13 different countries (only put 3 as I assume I can copy the code and adjust for the rest)

Perhaps this is too far below your level here for you to be able to help?

I've just written an old school file to do some of it.

CD EN
Rename images en
CD ..
(repeated for the other 12)

I will just have to manually create the network folder and drag and drop each renamed folder across, thanks anyway :(

Re: Hopefully a straightforward one?

Posted: 14 Sep 2021 23:24
by Aacini
Try this:

Code: Select all

@echo off
setlocal

rem User inputs a number
set /P "number=Please input number: "

rem Make folder
md Y:\Images\email\%number%

rem Rename folder "images" in 13 different 2-letters countries to lowcase country
rem and copy this lowcase country folder to previously created folder
for %%a in (en fr se etc ...) do (
   ren %%a\images %%a
   xcopy /E /I %%a\%%a Y:\Images\email\%number%\%%a
   pause
)

rem Fix the special case
ren SE\se sv
ren Y:\Images\email\%number%\se sv
Antonio

Re: Hopefully a straightforward one?

Posted: 15 Sep 2021 02:02
by Kaarthuul
Perfect, thank you :)

Re: Hopefully a straightforward one?

Posted: 15 Sep 2021 02:18
by Kaarthuul
Just had a thought, sometimes there are a few countries missing. This still works fine, I just get an error on the screen to say folder does not exist and it carries on to the next. Is there any way to jump missing folders? TIA