Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

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

05 Oct 2017   #1

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

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!


My System SpecsSystem Spec
06 Oct 2017   #2

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 System SpecsSystem Spec

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

Thread Tools

Similar help and support threads
Thread Forum
Help batch file to move files in list to created subdirectory
Please excuse me in advance because I am not very experienced making batch files. I'm not asking for a free lunch and would gladly paypal someone some cash for a working batch file. I have a parent folder that contains several subfolders. Each subfolder has several files in them. I need a batch...
General Discussion
Remove Admin Rights and Move instead of Copy | Batch file
I have a list of 1000 files names that I put in a text file named list.txt. Need to find them in more folders, sub folders which has 12000+ files in it. The below script works fine but I would like the Admin Right to be removed and also I want the files to be moved permanently into C:\your_files....
General Discussion
Batch File to Move a list of files.
Hey All, I just joined this forum to find some help on a specific topic that I've been researching for like two hours now on google. I have a list of 1300 files that I need to move from one location to another (move not copy). I've found this batch file created by Neutron16 which performs a Move...
General Discussion
[Help] Batch File move every 15.000 files to another folders
Hi guys I'm new here, please help I have about 2 million email files that i want to convert into mbox files. but the tool i used only can convert every 15.000 files. so i need a batch file that can move this 2 million files into another folder (15.000 files each folder) and the folder name...
General Discussion
Batch code to read, then move files from one folder to another
I'm new to batch coding, so I was hoping someone could help me out. I need to read several .txt files and search them for a specific string, lets say "key1" and "key2." If the file has key1, then it needs to be moved into directory1. If the file has key2, then it needs to be moved to directory2....
General Discussion

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 09:01.
Twitter Facebook Google+ Seven Forums iOS App Seven Forums Android App