I want the batch file to move files %3 number of times, how can I accomplish this?
%1 is the source folder
%2 is the destination folder
%3 is the number of files
%4 is the filter.
This is the best I could come up with but it doesn't seem to work consistently.
@echo off
SETLOCAL EnableDelayedExpansion
set movedFiles=0
if [%4] EQU [] goto regular
:special
for /R "%1" %%G in (%4) do (
echo moving "%4"... "%%G"
move /Y "%%G" "%2"
set /a movedFiles+="1"
if !movedFiles! EQU %3 GOTO endOfCopy
)
GOTO endOfCopy
:regular
for /R "%1" %%G in (*) do (
echo moving... "%%G"
move /Y "%%G" "%2"
set /a movedFiles+="1"
if !movedFiles! EQU %3 GOTO endOfCopy
)
:endOfCopy
echo Done, %movedFiles% files Where copied successfully
ENDLOCAL