Batch File: Queuing Mechanism

Microsoft Windows 2000 terminal server w...
July 26, 2010 at 00:42:01
Specs: 2000
Hi there.

The scenario is I have 30-40 computers which need to transfer files to a single file server. To stop too many computers transferring at one time, I wish to implement this queuing system.

The transfer batch file, which create a file with the computer's name in a temp folder to indicate that a transfer is in progress. Upon completion this file will be deleted.

The queuing batch file that is run before the transfer batch file, which do the following. It will check in the temp directory how many files are in there. Using something like:
dir "C:\New Folder" /b/s |find /v /c "::"
If the number of files is (for example) equals or less than 4, it will call the transfer batch file. If the queue is full, can the queuing batch file be set to rerun after a certain amount of time?

Many thanks for any advice given.

See More: Batch File: Queuing Mechanism

Report •

July 26, 2010 at 07:22:01
Google for the tool sleep.exe that suspends the script for N secs then the following code

@echo off & setlocal
for /F "delims=" %%j in ('dir "C:\Quee Folder" /B 2^> nul ^| find /V /C ""') do set _quee=%%j
if %_quee% gtr  4 (sleep 60) else (call transfer)
goto :LOOP
:: End_Of_Batch

Report •
Related Solutions

Ask Question