先测试再用
遍历每个目录,速度慢- @echo off
- setlocal enabledelayedexpansion
- set /p "src=请输入要移动的目录层级数:"
- set /p "desc=请输入要移动到的目录层级数:"
- echo -----------------------
- set /a "up=%src%-%desc%+1"
- for /r /d %%i in (*) do (
- cd /d "%%i"
- for /l %%a in (1,1,%src%) do cd ..
- if "!cd!\"=="%~dp0" (
- echo 移动 %%i
- cd /d "%%i"
- for /l %%a in (1,1,%up%) do cd ..
- echo 移到 !cd!
- move /y "%%i" "!cd!" >nul && echo 成功 || echo 失败
- echo -------------------
- )
- )
- pause&exit
复制代码
|