Solved Batch Script: How to Set the Number of Files to Copy or Move

darellaustinjr

New member
Local time
1:37 PM
Messages
2
HI All,

I'm very new to batch programming and have a question about a task.

I'm looking to create a batch programming script where I can copy 10 files at a time

every 10 minutes to a destination folder until all files have been copied

ex: select 1st 10 files to copy over,wait 10 minutes, then copy next 10 files and so on.

This is like a for loop, but confused on how to set it up.

I've played around with robocopy cmd but I can only copy all files to a destination folder.

ex: I want to copy from this drive: C:\Users\austid02\Desktop\test

place files into this folder path: C:\Users\austid02\Desktop\test2

thanks in advance very grateful!

Darell
 

My Computer My Computer

At a glance

Windows 7
Computer type
PC/Desktop
OS
Windows 7
Hi All, I found a solution and it's posted below, thanks as always :-)
echo off

set Source=C:\Users\austid02\Desktop\test
set Target=C:\Users\austid02\Desktop\test2

set MaxLimit=10

for /f "tokens=1* delims=[]" %%G in ('dir /A-D /B "%Source%\*.*" ^| find /v /n ""') do (
copy /y "%Source%\%%~nxH" "%Target%"
if %%G==%MaxLimit% exit /b 0
)
 

My Computer My Computer

At a glance

Windows 7
Computer type
PC/Desktop
OS
Windows 7
Back
Top