windows文件批量处理,移动和重命名(解决批量移动,文件名重复会丢失)

版权声明:转载注明康弘雲 https://blog.csdn.net/weixin_43560803/article/details/84679284
@echo off
cd/d "F:\zzzzzzz\pa_chong"
echo 正在移动...
set a=100
setlocal EnableDelayedExpansion
for /d %%i in (*) do (
   pushd "%%~i"
   for /f "delims=" %%j in ('dir/b/s/a-d')do (
     echo move "%%j" "F:\zzzzzzz\pa_chong"
     set /A a+=1
     ren "%%j" "tutu!a!.jpg"
     echo ren "%%j" "tutu!a!.jpg"
    echo %%j =^> %%i)
   popd
   )
pause
@echo off & setlocal enabledelayedexpansion
 
set tp=F:\zzzzzzz\pa_chong
for /f "delims=" %%a in ('dir /ad /b /s %tp%') do (
  set cp="%%~a"
  for /f "delims=" %%i in ('dir /ad /b !cp! ^| find /v /c ""') do (set /a cnt=%%i)
  if {!cnt!}=={0} (
    set up="%%~da%%~pa"
    move !cp!\*.* !up! 2>nul
    echo move !cp!\*.* !up! 2>nul
    echo rd /s /q !cp! 2>nul
  )
)
 
endlocal & @echo on

参考代码

bat文件

https://zhidao.baidu.com/question/575493728.html

https://jingyan.baidu.com/article/335530dae7303819cb41c32f.html

猜你喜欢

转载自blog.csdn.net/weixin_43560803/article/details/84679284
今日推荐