Question

  • Thread starter Thread starter Len A
  • Start date Start date
L

Len A

I have a batch file that copies over some files I want on every computer. I
would like for it to only do it once, how do I do this?

I found the "runOnce" setting in the registry, is there a way I can set or
manage this using AD or should I use another approach?

Thanks
 
Len A said:
I have a batch file that copies over some files I want on every computer.
I would like for it to only do it once, how do I do this?

I found the "runOnce" setting in the registry, is there a way I can set or
manage this using AD or should I use another approach?

Someone may offer something more elegant but in addition to "runonce"
(biggest problem is setting THAT -- and setting IT only once <grin>):

You could put a test for one of the files in and just skip the copy.

You could use XCOPY with /d to only add files that are new or newer
than current. /y to automatically overwrite.

To avoid overwriting existing but older files you can build a LARGE file
of just "n" on a single line and place in a well known place -- my file is
in my batch command directly and is called "no.txt" with 10,000 lines
of just "n".

Then using "xcopy /d <c:\batch\no.txt" will skip all of the existing files
and
only add new files -- there should be a /no overwrite switch in XCOPY
but this is as good (almost.)
 
I came to the same conclusion as you, and used the xcopy switch.. But I need
to erase the old folder, copy a new in some cases. I came across the
"setting run once once" problem too- you would think there is a way built
in to do this with all the other stuff AD does...
 
Len A said:
I came to the same conclusion as you, and used the xcopy switch.. But I
need to erase the old folder, copy a new in some cases. I came across the
"setting run once once" problem too- you would think there is a way built
in to do this with all the other stuff AD does...

Not particularly, AD isn't really about file management, that is left
to Explorer and the command line utilities mostly.

If you want to delete the originals that is easy enough. You can
use either "rd /s /q \parentDirPath" (VERY DANGEROUS) or
"del /s /q \parentDirPath" (almost as DANGEROUS)" or you
can use a more complicated

"for .. in ('dir /b /a-d /s \newParentPath') do if exist del "%a"

(but you have to use the ~ tilde operators to pick out the file
name from the path and prefix the old path for the del part.)
 
Yes, you can run xcopy with say /d /e /y switches defined. But there
are also third-party tools such as Scriptlogic Secure Copy (http://
www.scriptlogic.com) that can check for changes and overwrite files
only when the check will show the change of either file attribute,
size, date or ACL. We are also using their Desktop Authority to run
some tasks on the time basis, so the task executes just one single
time and never does it anymore or it executes on daily/weekly basis.
 
Back
Top