PDA

View Full Version : Help with Copy Files (NET)



impu007
03-29-2004, 08:20 AM
I have a script which Jama helped me create that allows me to copy IIS logs from few webserver to a mapped drive. But I like to modify a little, so it

1) Copies one server at a time and move on to the next one after first one complete (may be a 3 sec sleep in between.
2)Also perform delete after confirming that file were copied successfully (currently it logs in event log but only listing the first logs that was copied and skipping the rest.

3) need to find out how can I include authentication per server, because many of the webservers still not under Active Directory but the server this log running in and logs are copied to are part of AD.

Here is a sample of what I have thanks to Jama


'contains list of servers in the following format
'<servername>,c$\winnt\system32\LogFiles\W3SVC1

ServerListFile= "c:\serverlist.txt"

'Target
TargetFolder = "\\mapdrive\share"

Const ForReading = 1
set fso = CreateObject("Scripting.FileSystemObject")
set SLF = FSO.OpenTextFile(ServerListFile, ForReading)

Do While Not SLF.AtEndOfStream

s = SLF.ReadLine
If s= "" Then
Else

MyArray = split(s,",")
ServerName= Trim(MyArray(0))
LogFolderPath = Trim(MyArray)1))
End If

'Skipping some Dateformat variable and skipping to here

StrFile="filename" & ".log"

SourceFolder = "\\" & ServerName & "\" LogFolderPath

SourceFile= SourceFolder & "\" & StrFile
DestFile=TargetFolder & "\" & ServerName & "\" & StrFile



"When all else fails, take a break and smoke a bud"