• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

windows events

A
#1
Hi,

I am about to develop a WSH script that will compare files (office
templates) in a central storage location to local files, and copy them
to the local system if necessary. Lots of users, heterogenous setup OS-
wise.

There are quite a lot of files to compare (>300). and some of them are
rather big (>3MB). Copying them over a VPN connection will take a bit of
time.

The script will be started from VBA code using a timer.

The idea is to have local user templates be updated without user-
intervention and without disruption of the users normal routines.

The script will essentially be a recursive algorhythm that will compare
files on the server to files on the local system, and copy them if the
files on the server are newer (in essence, a one-way syncing mechanism).

Since it can potentially involve heavy copying, I am worried about what
happens if a user shuts the system down.

1. What happens if a FileCopy operation is in progress?
2. what happens if the scripts routine (compare/(copy)/recurse) is still
in progress?

As to 1., will the operation be aborted, potentially leaving the user
with a corrupted new copy of a file?
As to 2., is there a way to do something like 'windows is shutting down
event so exit'? Is it needed?

Any thoughts are much appreciated,

TIA,
arno
 

My Computer

P

Paul Randall

#2
"arno" <noreplyAThighiqDOTnl@xxxxxx> wrote in message
news:MPG.23ca2692e78a0396989682@xxxxxx

>
>
> Hi,
>
> I am about to develop a WSH script that will compare files (office
> templates) in a central storage location to local files, and copy them
> to the local system if necessary. Lots of users, heterogenous setup OS-
> wise.
>
> There are quite a lot of files to compare (>300). and some of them are
> rather big (>3MB). Copying them over a VPN connection will take a bit of
> time.
>
> The script will be started from VBA code using a timer.
>
> The idea is to have local user templates be updated without user-
> intervention and without disruption of the users normal routines.
>
> The script will essentially be a recursive algorhythm that will compare
> files on the server to files on the local system, and copy them if the
> files on the server are newer (in essence, a one-way syncing mechanism).
>
> Since it can potentially involve heavy copying, I am worried about what
> happens if a user shuts the system down.
>
> 1. What happens if a FileCopy operation is in progress?
> 2. what happens if the scripts routine (compare/(copy)/recurse) is still
> in progress?
>
> As to 1., will the operation be aborted, potentially leaving the user
> with a corrupted new copy of a file?
> As to 2., is there a way to do something like 'windows is shutting down
> event so exit'? Is it needed?
>
> Any thoughts are much appreciated,
>
> TIA,
> arno
I have a comment about the comparison problem:

Why not set up a script on all of the machines that will create a table of
checksums for all these files of interest on the system; they might update
the checksums on a regular basis or on demand from a central location. This
would require minimal bandwidth and would spread the bulk of the CPU
requirements to minimize the impact on any one system. Then your script
would only have to compare the table entries for the files in question and
only copy those files that are out of date. I think Microsoft's Capicom
object is scriptable and will create CRC32 and MD5 checksums, and is freely
downloadable to those machines on which it does not already reside.
http://www.microsoft.com/downloads/results.aspx?pocId=&freetext=capicom&DisplayLang=en

-Paul Randall
 

My Computer

C

Chip Orange

#3
You don't really need to reinvent the wheel; MS has both XCopy and Robocopy
utilities, which will copy based on newer dates, to do this kind of thing
for you.

I believe they handle the situation where the copy was not allowed to
complete properly; however, if you must do this yourself, copy the file to a
temporary directory on the same drive as your destination file, and when the
copy is complete, delete the destination file and rename the copy in the
temp directory to the name of the destination file.

hth,

Chip


"arno" <noreplyAThighiqDOTnl@xxxxxx> wrote in message
news:MPG.23ca2692e78a0396989682@xxxxxx

>
>
> Hi,
>
> I am about to develop a WSH script that will compare files (office
> templates) in a central storage location to local files, and copy them
> to the local system if necessary. Lots of users, heterogenous setup OS-
> wise.
>
> There are quite a lot of files to compare (>300). and some of them are
> rather big (>3MB). Copying them over a VPN connection will take a bit of
> time.
>
> The script will be started from VBA code using a timer.
>
> The idea is to have local user templates be updated without user-
> intervention and without disruption of the users normal routines.
>
> The script will essentially be a recursive algorhythm that will compare
> files on the server to files on the local system, and copy them if the
> files on the server are newer (in essence, a one-way syncing mechanism).
>
> Since it can potentially involve heavy copying, I am worried about what
> happens if a user shuts the system down.
>
> 1. What happens if a FileCopy operation is in progress?
> 2. what happens if the scripts routine (compare/(copy)/recurse) is still
> in progress?
>
> As to 1., will the operation be aborted, potentially leaving the user
> with a corrupted new copy of a file?
> As to 2., is there a way to do something like 'windows is shutting down
> event so exit'? Is it needed?
>
> Any thoughts are much appreciated,
>
> TIA,
> arno
 

My Computer

A
#4
Tx. Didn't know abt robocopy. Seems like that would be the tool of
choice for this, but it seems it is Vista-specific (would require
additional install on XP?) By now I've already written a util :-) It
does indeed use a temporary filename.

arno


In article <uPplj8adJHA.1916@xxxxxx>,
Chip.Orange@xxxxxx says...>

> You don't really need to reinvent the wheel; MS has both XCopy and Robocopy
> utilities, which will copy based on newer dates, to do this kind of thing
> for you.
>
> I believe they handle the situation where the copy was not allowed to
> complete properly; however, if you must do this yourself, copy the file to a
> temporary directory on the same drive as your destination file, and when the
> copy is complete, delete the destination file and rename the copy in the
> temp directory to the name of the destination file.
>
> hth,
>
> Chip
>
>
> "arno" <noreplyAThighiqDOTnl@xxxxxx> wrote in message
> news:MPG.23ca2692e78a0396989682@xxxxxx

> >
> >
> > Hi,
> >
> > I am about to develop a WSH script that will compare files (office
> > templates) in a central storage location to local files, and copy them
> > to the local system if necessary. Lots of users, heterogenous setup OS-
> > wise.
> >
> > There are quite a lot of files to compare (>300). and some of them are
> > rather big (>3MB). Copying them over a VPN connection will take a bit of
> > time.
> >
> > The script will be started from VBA code using a timer.
> >
> > The idea is to have local user templates be updated without user-
> > intervention and without disruption of the users normal routines.
> >
> > The script will essentially be a recursive algorhythm that will compare
> > files on the server to files on the local system, and copy them if the
> > files on the server are newer (in essence, a one-way syncing mechanism).
> >
> > Since it can potentially involve heavy copying, I am worried about what
> > happens if a user shuts the system down.
> >
> > 1. What happens if a FileCopy operation is in progress?
> > 2. what happens if the scripts routine (compare/(copy)/recurse) is still
> > in progress?
> >
> > As to 1., will the operation be aborted, potentially leaving the user
> > with a corrupted new copy of a file?
> > As to 2., is there a way to do something like 'windows is shutting down
 

My Computer

C

Chip Orange

#5
I believe robocopy is available for xp, but it is a separate download as you
say (I think it's in the xp resource kit).

still, it does so much it's worth pushing out (there's no installation, just
copy it to some directory on the path, that's it). So you add one line to
copy it to your script, then from then on you can use robocopy to copy the
templates.


"arno" <noreplyAThighiqDOTnl@xxxxxx> wrote in message
news:MPG.23d7043ec2f481a2989688@xxxxxx

> Tx. Didn't know abt robocopy. Seems like that would be the tool of
> choice for this, but it seems it is Vista-specific (would require
> additional install on XP?) By now I've already written a util :-) It
> does indeed use a temporary filename.
>
> arno
>
>
> In article <uPplj8adJHA.1916@xxxxxx>,
> Chip.Orange@xxxxxx says...>

>> You don't really need to reinvent the wheel; MS has both XCopy and
>> Robocopy
>> utilities, which will copy based on newer dates, to do this kind of thing
>> for you.
>>
>> I believe they handle the situation where the copy was not allowed to
>> complete properly; however, if you must do this yourself, copy the file
>> to a
>> temporary directory on the same drive as your destination file, and when
>> the
>> copy is complete, delete the destination file and rename the copy in the
>> temp directory to the name of the destination file.
>>
>> hth,
>>
>> Chip
>>
>>
>> "arno" <noreplyAThighiqDOTnl@xxxxxx> wrote in message
>> news:MPG.23ca2692e78a0396989682@xxxxxx

>> >
>> >
>> > Hi,
>> >
>> > I am about to develop a WSH script that will compare files (office
>> > templates) in a central storage location to local files, and copy them
>> > to the local system if necessary. Lots of users, heterogenous setup OS-
>> > wise.
>> >
>> > There are quite a lot of files to compare (>300). and some of them are
>> > rather big (>3MB). Copying them over a VPN connection will take a bit
>> > of
>> > time.
>> >
>> > The script will be started from VBA code using a timer.
>> >
>> > The idea is to have local user templates be updated without user-
>> > intervention and without disruption of the users normal routines.
>> >
>> > The script will essentially be a recursive algorhythm that will compare
>> > files on the server to files on the local system, and copy them if the
>> > files on the server are newer (in essence, a one-way syncing
>> > mechanism).
>> >
>> > Since it can potentially involve heavy copying, I am worried about what
>> > happens if a user shuts the system down.
>> >
>> > 1. What happens if a FileCopy operation is in progress?
>> > 2. what happens if the scripts routine (compare/(copy)/recurse) is
>> > still
>> > in progress?
>> >
>> > As to 1., will the operation be aborted, potentially leaving the user
>> > with a corrupted new copy of a file?
>> > As to 2., is there a way to do something like 'windows is shutting down
>
>
 

My Computer

Users Who Are Viewing This Thread (Users: 1, Guests: 0)