本帖最后由 comicguests 于 2012-6-27 15:13 编辑
下面的代码能移动文件到根目录,但我想移动到第一层文件夹...应该如何修改呢?
感谢关注!!- @echo off
- echo 移动文件中...
- for /f "delims=" %%i in ('dir *.* /a-d /s /b') do (
- if not "%%~dpi"=="%~dp0" call :movefile "%%i"
- )
- echo 移动文件完成!
- exit
- :movefile
- if exist "%~dp0%~nx1" set "n="&goto renfile
- move %1 "%~dp0">nul 2>nul||(attrib -r -h -s %1& move %1 "%~dp0">nul)
- goto :eof
- :renfile
- set/a n+=1
- if exist "%~dp0%~n1(%n%)%~x1" goto renfile
- move %1 "%~dp0%~n1(%n%)%~x1">nul 2>nul||(
- attrib -r -h -s %1& move %1 "%~dp0%~n1(%n%)%~x1">nul)
- goto :eof
复制代码 嗯,1楼所言甚是,那么,将e:\a\b\c\*里的文件,全移到e:\a里(包含b、c中全部文件) |