Batch script to create folders based on filenames

六眼飞鱼酱① 提交于 2019-12-01 12:16:53

from the command line

for /f %f in ('dir *.png /b') do md %~nf & move %f .\%~nf\0000.png

if in the batch file

for /f %%f in ('dir *.png /b') do md %%~nf & move %f .\%%~nf\0000.png

Here is the example

c:\Temp\pp>dir /s/b
c:\Temp\pp\b.png
c:\Temp\pp\p.png

c:\Temp\pp>for /f %f in ('dir *.png /b') do md %~nf & move %f .\%~nf\0000.png

c:\Temp\pp>md b   & move b.png .\b\0000.png
        1 file(s) moved.

c:\Temp\pp>md p   & move p.png .\p\0000.png
        1 file(s) moved.

c:\Temp\pp>dir /s/b
c:\Temp\pp\b
c:\Temp\pp\p
c:\Temp\pp\b\0000.png
c:\Temp\pp\p\0000.png
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!