I have a folder struktur like this:
I need to import all images to a website, but the file name have to differ to each other, so I cannot import two (or) more files with the same name. Just numerating the images to master1.jpg, master2.jpg, ... with e.g. AntRenamer is no proper solution, because the image paths/names are assigned to an item number in a csv file I also need to import.
So: How can I bulk add the folder names to the files like this?
Thanks for your help!
@echo off setlocal EnableDelayedExpansion cd C:\Parent\Folder\OfFirstNumberedFolders for /F "delims=" %%a in ('dir /B /S /A-D master.jpg') do ( set "fullName=%%a" for /F "tokens=1-3 delims=\" %%b in ("!fullName:%CD%=!") do ( ECHO ren "%%a" "%%b_%%c_%%d" ) )
Try this in Windows. Remove the
echo to make it actually perform the rename.
@echo off for /f "delims=" %%z in ('dir "master.jpg" /b /s /a-d ') do ( for %%a in ("%%~dpz%\.") do ( for %%b in ("%%~dpa\.") do ( echo ren "%%z" "%%~nxb_%%~nxa_%%~nxz" ) ) ) pause