Last active
December 29, 2018 06:49
-
-
Save foundkey/f7345f7e4722c75c7fc321a25d89c005 to your computer and use it in GitHub Desktop.
copy special type file to targe folder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
::复制指定类型的文件到同一个文件夹 | |
::2018-12-19 | |
::FK | |
@echo off | |
setlocal enabledelayedexpansion | |
set DIR=%~pn1 | |
set /p Type= filter file extension: | |
set OUTDIR=%~1_%Type% | |
if NOT EXIST %OUTDIR% ( | |
mkdir %OUTDIR% | |
) | |
::拷贝指定类型文件添加随机数后缀,防止重名文件 | |
for /f %%i in ('dir /b /s %1\*.%Type%') do ( | |
copy %%~i %OUTDIR%\%%~ni_!RANDOM!_%%~xi | |
) | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment