分站内容可能或出现渲染错误或内容过时等问题,请以主站为准!

将所有子文件夹里的文件上移一层

覆盖同名文件

@echo off
(for /f "delims=" %%a in ('dir /b /s /ad') do (
        move /y "%%a\*.*" "%%a\.."&&rd %%a
))>nul 2>nul
for /f "delims=" %%i in ('dir /ad /b /s^|sort /r') do rd /q "%%i" 2>nul
pause

选择是否覆盖同名文件

@echo off
(for /f "delims=" %%a in ('dir /b /s /ad') do (
        move /-y "%%a\*.*" "%%a\.."&&rd %%a
))>nul 2>nul
for /f "delims=" %%i in ('dir /ad /b /s^|sort /r') do rd /q "%%i" 2>nul
pause

将当前文件夹里子文件夹里的文件移动到all文件夹

for /f "delims=" %%p in ('dir /b/ad') do move %%p\*.* all\
pause