Jump to content

Recommended Posts

Posted

I have the following script below. What it odes is copy all the contents of a folder on the network to a designated folder on the client. I want to run this on a OU which contains 25 PC's so it copies the files across to the folder. What i need help with is......once the files are copied over on log in on day one I do not want them to be copied over every time the computer is restarted. Is there a way i can stop this so that the files are only copied once and the script checks this and then stops. I know i could leave it in the OU for a couple of days but what happens if i have to re-image a machine and the script is no longer in the OU?

 

here is what i have so far and it does work as far as copying the contents of one folder to another.

 

Const OVERWRITE_EXISTING = True

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objShell = CreateObject("Wscript.Shell")

' global variables

source = "\\pcname\data\engl\*.*"

dest = "c:\Program Files\myprogram\data\eng"

objFSO.CopyFile source, dest, OVERWRITE_EXISTING

If Err = 0 Then

 

End If

Posted

If objFSO.FileExists("file to check") Then
'File allready exists
Else
'Copy you files here
End If 

 

Use the FileExists to check for the presence of any of the files or copy over a flag.txt and check for that.

 

Or you can use FolderExists to check for the existence of a folder.

 

Ben

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...