I have a large collection of images in various locations, which all sit in a folder called "global_en-us" (referring to images to be used on an EN site). These all need duplicated to various other languages (e.g. global_de-de) as only the EN was provided - due to the fact that nothing on the images is language specific. Obviously the best solution would be to rewrite the paths on the sites to remove references to languages but with there being 3-4 languages per collection, and somewhere between 100-120 collections, that's just too big a task and so a bat script to duplicate them all as needed would be handier.
The images are all set up similar to this. The path from "/assets/images" is the important bit, I would like to run the script from there and let it work its way down
c:/somefolder/assets/images/special-offers/some-promo-name/global_en-us/<images>
c:/somefolder/assets/images/layout/some-component-name/global_en-us/<images>
c:/somefolder/assets/images/tournaments/some-tourney-name/global_en-us/<images>
I currently have a script that I cobbled together with minimal knowledge of how bat scripting really works, which you can specify a location that contains the global_en-us folder and it will duplicate it to all required languages. I've copied it below:
@echo off
IF EXIST log.txt (
del log.txt
)
set /p folder="Enter location : "
set folderTest=%folder:~-1%
echo %folderTest% > log.txt
if %folderTest% == \ echo "slash found" > log.txt
if NOT %folderTest% == \ set folder=%folder%\
xcopy /Y /S "%folder%global_en-us\*.*" "%folder%global_bg-bg\"
xcopy /Y /S "%folder%global_en-us\*.*" "%folder%global_pt-br\"
xcopy /Y /S "%folder%global_en-us\*.*" "%folder%global_cs-cz\"
xcopy /Y /S "%folder%global_en-us\*.*" "%folder%global_da-dk\"
xcopy /Y /S "%folder%global_en-us\*.*" "%folder%global_de-de\"
xcopy /Y /S "%folder%global_en-us\*.*" "%folder%global_el-gr\"
xcopy /Y /S "%folder%global_en-us\*.*" "%folder%global_en-us\"
xcopy /Y /S "%folder%global_en-us\*.*" "%folder%global_es-es\"
xcopy /Y /S "%folder%global_en-us\*.*" "%folder%global_es-la\"
xcopy /Y /S "%folder%global_en-us\*.*" "%folder%global_et-ee\"
xcopy /Y /S "%folder%global_en-us\*.*" "%folder%global_fi-fi\"
xcopy /Y /S "%folder%global_en-us\*.*" "%folder%global_fr-fr\"
xcopy /Y /S "%folder%global_en-us\*.*" "%folder%global_hr-hr\"
xcopy /Y /S "%folder%global_en-us\*.*" "%folder%global_hu-hu\"
xcopy /Y /S "%folder%global_en-us\*.*" "%folder%global_is-is\"
xcopy /Y /S "%folder%global_en-us\*.*" "%folder%global_it-it\"
xcopy /Y /S "%folder%global_en-us\*.*" "%folder%global_ja-jp\"
xcopy /Y /S "%folder%global_en-us\*.*" "%folder%global_lt-lt\"
xcopy /Y /S "%folder%global_en-us\*.*" "%folder%global_lv-lv\"
xcopy /Y /S "%folder%global_en-us\*.*" "%folder%global_nl-nl\"
xcopy /Y /S "%folder%global_en-us\*.*" "%folder%global_no-no\"
xcopy /Y /S "%folder%global_en-us\*.*" "%folder%global_pl-pl\"
xcopy /Y /S "%folder%global_en-us\*.*" "%folder%global_pt-pt\"
xcopy /Y /S "%folder%global_en-us\*.*" "%folder%global_ro-ro\"
xcopy /Y /S "%folder%global_en-us\*.*" "%folder%global_ru-ru\"
xcopy /Y /S "%folder%global_en-us\*.*" "%folder%global_sv-se\"
xcopy /Y /S "%folder%global_en-us\*.*" "%folder%global_si-si\"
xcopy /Y /S "%folder%global_en-us\*.*" "%folder%global_ua-ua\"
xcopy /Y /S "%folder%global_en-us\*.*" "%folder%global_zh-cn\"
xcopy /Y /S "%folder%global_en-us\*.*" "%folder%global_zh-tw\"
What I would like, if this is becoming clearer now, is instead of me having to run this 100-120 times on each folder such as "c:/somefolder/assets/images/special-offers/some-promo-name/", I can tell it "c:/somefolder/assets/images/" and let it work its way resursivly, and when it finds "global_en-us" it does the xcopy as needed, and then goes back and moves on.