**DONOTDELETE**
(Lurker)
2001-08-15 12:32 AM
Need help creating a script to check/update directory

I'm having trouble creating a script to check a directory and copy files across that are new/updated.
I'll try to sum up my problem easily:
Computer A is logging onto Server B. Server B has a directory called \\serverB\update . I need Computer A to have this and the files in it only when it's updated.
Is it possible to check Computer A to verify it has the directory (and if not create it) and then compare the files in it and copy over any newer files.
Any help, guidance is appreciated. I'm rather stuck right now...thanks


Sealeopard
(KiX Master)
2001-08-15 02:18 AM
Re: Need help creating a script to check/update directory

Yes, you can do that.

Use EXIST to check whether the directory exists. Then use the DIR command to enumerate the files in your source directory. Use COMPAREFILETIMES to check for updated files and copy if neccessary.

Jens

E.G.:

code:

if exist('c:\temp\demo')=0
md 'c:\temp\demo'
endif

if comparefiletimes('\\server\sourcedir\file','c:\temp\demo\file')=1
copy '\\server\sourcedir\file' 'c:\temp\demo\file'
endif




**DONOTDELETE**
(Lurker)
2001-08-15 03:20 AM
Re: Need help creating a script to check/update directory

ah,
Thanks alot i'll give it a try.


MCA
(KiX Supporter)
2001-10-23 07:49 AM
Re: Need help creating a script to check/update directory

Dear,

Welcome to the board.

We don't know you solve your problem, but for ideas see also our
script dircompare.kix on our site http://home.wanadoo.nl/scripting
greetings.


btw: symbol on our homepage has been linked to related http://kixtart.org topic.