Discussion Locked

Batch file

0 helpful
10 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I need a batch file that will move files from one directory to another on the same box "NT 4.0 server" and I need to know how to schedule it to look every 30Sec for new files to move.
Origin path is E:\ONYX_1\PROOFS
Destination path is E:\ONYX_1\INPUT\HP

10 replies

by ron navon

Dear Sir,

You can make a batch file as you did in Windows 95/98 or Dos, use the MOVE command, source and Destination Directory including file.
You can find the WINAT utility in resource Kit and ver easy schadule it.
If you need this utility contact me I will send you the Schaduling utilit.
you have put the file of utility in \WINNT\System32\.
Good luck.

Ron

by simpsin

The batch file is not a problem, but either with "winat" utility or th "at" commands in command line mode, the fastest you run it is every minute. If you absolutely have to do-it every 30 sec's I would suggest making an exe application that runs in background.
the AT commands have a tendancy to fail from time to time. The other option is a small utility I found called DOS4NT. You can make very complicated batch files with timers and all. Gook Luck
write if you have any other questions on this.
simpsin@hotmail.com

by jewright

You will need the "Wait" utility from the NT resource
kit before you try this (if you have mis-placed yours
I will e-mail the file to you).....

rem Create the top of the loop

:Home

rem Copy files in all sub-directories with the archive
rem attribite set and turn off the archive bit. Also continue
rem on an error because the file may be in use.

Xcopy E:\ONYX_1\PROOFS\*.* E:\ONYX_1\INPUT\HP /s /m /c

rem Use the wait utility and tell it to wait for 30 seconds

Wait 30

rem Don't use the next line unless you absolutely must destroy
rem the old files. I would much rather you create duplicates -
rem This line will completely remove and recreate the directory
rem if the removal works (the RD will fail if a file is in use)

RD E:\ONYX_1\PROOFS /s /q |MD E:\ONYX_1\PROOFS

GoTo Home

That's all you will have to do. As always make a good back-up
before running a script that will do any file manipulation.

Thanks.....Jeremy (JeWright@HotMail.com)

by dcarroll809

The following batch file should do what you need. You will need the "sleep" untility from the NT Resource Kit.

@echo off
:start
if exist e:\onyx_1\proofs\*.* goto mv
; to shorten the batch file
; remove these (6) six comment lines
; and thefollowing (5) five lines,
; then combine the 'exist' and 'move' lines
; by removing the 'goto mv' and appending
; the 'move' line to the 'if exist' line
sleep 1800
; wait 30 seconds
goto start
; start over
:mv
move e:\onyx_1\proofs\*.* e:\onyx_1\input\hp
sleep 1800
goto start
:end

by dvn

Hi David,
Ididn't notice that you need to delete the old files
Dmitri
:start
ROBOCOPY E:\ONYX_1\PROOFS\ E:\ONYX_1\INPUT\HP *.* /XD
del E:\ONYX_1\PROOFS\*.*/Q
sleep 30
goto start

This discussion is closed to new replies.