批处理命令将png文件移动到文件夹相同的名称文件和文件夹

时间:2021-12-12 02:23:14

I want to move png files to folders same name files and folders using batch dos.

我想使用批处理dos将png文件移动到文件夹相同的名称文件和文件夹。

Example:-
abc <= folder 
adc.png          => abc\abc.png

abc1 <= folder 
adc1.png          => abc1\abc1.png

a b c <= folder 
a d c.png          => a b c\a b c.png

A b c D <= folder 
A b c D.png          => A b c D\A b c D.png

etc.

1 个解决方案

#1


2  

for /F "Tokens=* delims=" %%I in ('dir /a-d /b *.png') do (
   mkdir "%%~nI"
   move "%%~I" "%%~nI/%%~I"
)

Something like this...

这样的东西......

#1


2  

for /F "Tokens=* delims=" %%I in ('dir /a-d /b *.png') do (
   mkdir "%%~nI"
   move "%%~I" "%%~nI/%%~I"
)

Something like this...

这样的东西......