@echo off
set src=d:\1
set dest=d:\2
set dest2=e:\2
for /f "delims=" %%e in ('dir "%src%" /b /a-d ^| findstr /v "\.aria2$"') do (
if "%%e" neq "%0" (
if not exist "%%e.aria2" (
cd %src%
move /y "%%e" "%dest%"
)
)
)
dir %src% /s /b /o-d > "2.txt"
findstr "aria2" 2.txt>a1.txt
copy a1.txt a.txt
del b.txt 2>NUL
echo strInput = "a.txt" >a.vbs
echo strOutput = "b.txt" >>a.vbs
echo Set objFSO = CreateObject("Scripting.FileSystemObject") >>a.vbs
echo Set objInput = objFSO.OpenTextFile(strInput, 1) >>a.vbs
echo Set objOutput = objFSO.OpenTextFile(strOutput, 2, True, 0) >>a.vbs
echo Do Until objInput.AtEndOfStream >>a.vbs
echo strLine = Replace(objInput.ReadLine, ".aria2", "") >>a.vbs
echo objOutput.WriteLine strLine >>a.vbs
echo Loop >>a.vbs
echo objInput.Close >>a.vbs
echo objOutput.Close >>a.vbs
cscript //nologo a.vbs
move /y b.txt a.txt
del a.vbs
del b.txt 2>NUL
echo strInput = "a.txt" >a.vbs
echo strOutput = "b.txt" >>a.vbs
echo Set objFSO = CreateObject("Scripting.FileSystemObject") >>a.vbs
echo Set objInput = objFSO.OpenTextFile(strInput, 1) >>a.vbs
echo Set objOutput = objFSO.OpenTextFile(strOutput, 2, True, 0) >>a.vbs
echo Do Until objInput.AtEndOfStream >>a.vbs
echo strLine = Replace(objInput.ReadLine, "%src%", "") >>a.vbs
echo objOutput.WriteLine strLine >>a.vbs
echo Loop >>a.vbs
echo objInput.Close >>a.vbs
echo objOutput.Close >>a.vbs
cscript //nologo a.vbs
move /y b.txt a.txt
del a.vbs
dir %src% /b /ad > "3.txt"
(for /f "tokens=1* delims=\" %%c in (a.txt) do echo %%c)>1.txt
for /f "delims=" %%a in (1.txt) do (
for %%b in (3.txt) do (
echo %%b
(
findstr /v "%%a" "%%b"
)> #tmp# && move #tmp# "%%b">nul
))
for /f %%i in (3.txt) do move /y "%%i" "%dest%"
xcopy /s /e /i /y "%dest%" "%dest2%"
echo rd /q /s %dest%
pause