Moving X number of files with a batch

April 6, 2011 at 02:13:43
Specs: Windows 7
I have 132 000 files I need to move and would like to move 100 at a time but after I have moved the first 100 another program must run.

I have found the following script very usefull but it runs till alll files are sent and that is where I have got stuck

@echo off & setlocal EnableDelayedExpansion

set LIM=100
for %%i in (*) do (
set /A N+=1
move "%%i" D:/MYDIRECTORY
if !N! geq !LIM! (TimeOut 60 & set /A LIM+=100)
)
:DONE


Any advise will be appreciated.


See More: Moving X number of files with a batch

Report •


#1
April 6, 2011 at 18:37:23
@echo off & setlocal EnableDelayedExpansion

set LIM=100
for %%i in (*) do (
set /A N+=1
move "%%i" D:/MYDIRECTORY
if !N! == !LIM! (
puttheprogramhere
set N=1
)
:DONE


not tested thought... In these lines
if !N! == !LIM! (
puttheprogramhere
set N=1

if the number is 100 it willl launch your program and reset your counter.

Subhash Chandra.


Report •

#2
April 7, 2011 at 01:32:14
The issue now is it moves one file then runs the application.

Below is my current script
@echo off
@Echo Moving Files to archieve
move "K:\payslipupload\*.*" k:/payslipArchive/
@Echo Files Moved to archieve
@echo off & setlocal EnableDelayedExpansion

set LIM=100
for %%i in (*.pdf) do (
set /A N+=1
move "k:\payslips\%%i" K:/payslipupload/
if !N! === !LIM! (
START "Uploads" /d"C:\Users\05700661\Desktop\PayslipUploadTool 1.0.0.0" /WAIT "PayslipUploadTool.exe"
set N=1
)
:Done


Report •

Related Solutions


Ask Question