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
Use the FileExists to check for the presence of any of the files or copy over a flag.txt and check for that.Code:If objFSO.FileExists("file to check") Then 'File allready exists Else 'Copy you files here End If
Or you can use FolderExists to check for the existence of a folder.
There are currently 1 users browsing this thread. (0 members and 1 guests)