I don’t know if you were aware, but the other step you tried was powershell.exe
code not cmd.exe
.
Something similar to this may do what you require:
@Echo Off
Set "dirSrc=C:\App\Folder1"
Set "dirDst=C:\App\Folder2"
Set "extSrc=*.txt"
If Exist "%dirSrc%\%extSrc%" (CD /D "%dirSrc%" 2>Nul || Exit /B
) Else Exit /B
If Not Exist "%dirDst%\" (MD "%dirDst%" 2>Nul || Exit /B)
For /F "Skip=1 Delims=" %%A In ('Dir /B/A-D-H-L-S/O-D/TW "%extSrc%"'
) Do Move /Y "%%A" "%dirDst%">Nul 2>&1
Before you run it, you’ll need to make sure that the directories specified in lines 2
and 3
are correct and also the file mask in line 4
is correct.
0
solved move file based on the less than max system modified date available