How to bulk add folder name to file name?

前端 未结 2 1152
自闭症患者
自闭症患者 2021-01-26 11:32

I have a folder struktur like this:

/1/1/master.jpg
/1/2/master.jpg
/1/3/master.jpg
/2/1/master.jpg
/2/2/master.jpg
/2/3/master.jpg
...

2条回答
  •  情歌与酒
    2021-01-26 12:03

    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
    

提交回复
热议问题