Script for copying a particular directory of several PC’s to a server, creating a folder for each PC (read pcs.txt file), the script uses the unc path of pcs, you need access to resources \\pc\c$ of the pc’s, therefore recommended for Active Directory environments or (with domain )
the file pcs.txt:
PC001;JOSE; PC002;ANNA; ...
In this case it is to copy the archives of email and calendars of the Lotus Notes application.
I hope you like ,…
Const ForReading = 1 Const OverwriteExisting = TRUE Set objShell = CreateObject("Wscript.Shell") Set objFSO = CreateObject("Scripting.FileSystemObject") '----------------------- en el fichero pcs.txt es donde estan los nombres de los pcs------------- '------------------------pc01;PEPITO; '------------------------pc02;JAIMITO; Set objTextFile = objFSO.OpenTextFile _ ("E:\Copias\PCS.txt", ForReading) '------------------------------ leo todas las líneas de fichero------------------------- Do Until objTextFile.AtEndOfStream strNextLine = objTextFile.Readline arrServiceList = Split(strNextLine , ";") '-------------------- si no existe la carpeta destino la creo , la creo ------------------------- If not (objFSO.FolderExists("E:\Copias\" & arrServiceList(1) )) Then Set objFolder = objFSO.CreateFolder("E:\Copias\" & arrServiceList(1) ) End If '--------------------- compruevo que puedo acceder a la ruta unc para copiar los datos--------------- if objFSO.FolderExists("\\" & arrServiceList(0) & "\c$\ibm\lotus\notes\data\archive") then 'objFSO.DeleteFile("E:\Copias\" & arrServiceList(1) & \ "*.*") intReturn = objShell.Popup("Copiando: " & arrServiceList(0) & " Usuario: " & arrServiceList(1), 3,"Informacio" ,64) '------------------------Copio les dades cap al directori desti------------------------ objFSO.CopyFile "\\" & arrServiceList(0) & "\c$\ibm\lotus\notes\data\archive\*.*" , "E:\Copias\" & arrServiceList(1) & "" , OverwriteExisting end if Loop IntReturn = objShell.Popup("Fitxeros copiados", 3,"Información" ,64)