回复 26# 开心旺旺 - @echo off
- ::同时对txt、pdf、doc、epub文件进行分类归档
- for /f "delims=" %%a in ('dir /ad /s /b "D:\test\"') do (
- ::对txt文件进行分类归档
- if exist "%%a\*.txt" md "D:\txt\%%~na\" 2>nul & move "%%a\*.txt" "D:\txt\%%~na\"
- ::对pdf文件进行分类归档
- if exist "%%a\*.pdf" md "D:\pdf\%%~na\" 2>nul & move "%%a\*.pdf" "D:\pdf\%%~na\"
- ::对doc文件进行分类归档
- if exist "%%a\*.doc" md "D:\doc\%%~na\" 2>nul & move "%%a\*.doc" "D:\doc\%%~na\"
- ::对epub文件进行分类归档
- if exist "%%a\*.epub" md "D:\epub\%%~na\" 2>nul & move "%%a\*.epub" "D:\epub\%%~na\"
- ::要对什么格式的进行分类,自行添加即可,语法类似
- )
- pause
复制代码
|