Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy files from server to clients

Status
Not open for further replies.

rlee111

Technical User
Sep 10, 2001
27
GB
Hi

I need to copy a set of files, they are of different file types e.g.

file.ocx
file.exe
file.dll

from a server to clients
I would like to check for the existance of these files and if they dont exist copy the files to the client, if they do exist obviously do nothing.

I have been looking at fso to do this and my question is do I check for the existance of each file seperately because they are of different type?

Regards

Rob
 
On the Server, are these the only files in the specific folder you want to copy from, or are there other files in there that you don't want to copy?
 
Hi,
There will be a directory on the server containing only the files I want to copy.

Thanks

Regards,

Rob
 
What you'll want to do is a FOR NEXT on that folder.

SET G = oFS.GetFolder(<specified folder on server>)
SET f = G.Files
FOR EACH f1 in f
oFS.CopyFile f1, <new location>,TRUE
NEXT

This will grab every file in that folder, no matter what the name or extension is, and copy them over.
 
Ok thanks country73 for your help.

I have done it this way

Const OVERWRITE_EXISTING = True

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Wscript.Shell")

' global variables
source = "\\servername\imaging\*.*"
dest = "c:\windows\system\"

objFSO.CopyFile source, dest, OVERWRITE_EXISTING

If Err = 0 Then
Wscript.Echo "files copied successfully"
Else
Wscript.Echo "No files copied"
End If

objShell.Run ("%comspec% /c regsvr32.exe /u imgedit.ocx"), 1, true
objShell.Run ("%comspec% /c regsvr32.exe imgedit.ocx"), 1, true

This seems to work ok but now I face another problem, I have some w98 clients (I know!!) and some windows xp clients the files for w98 need to go into c:\windows\system and the files for wxp need to go into c:\windows\system32

I can run 2 seperate scripts but would rather have 1 script that can tell which operating system it is running against.

Can anyone help with that?

Thanks

Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top