Page 1 of 1 1
Topic Options
#11446 - 2001-08-15 12:32 AM Need help creating a script to check/update directory
Anonymous
Unregistered


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

Top
#11447 - 2001-08-15 02:18 AM Re: Need help creating a script to check/update directory
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
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


_________________________
There are two types of vessels, submarines and targets.

Top
#11448 - 2001-08-15 03:20 AM Re: Need help creating a script to check/update directory
Anonymous
Unregistered


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

Top
#11449 - 2001-10-23 07:49 AM Re: Need help creating a script to check/update directory
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
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.

_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 259 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.051 seconds in which 0.026 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org