Copy files from one server to another

Closed
SS - Oct 23, 2009 at 06:36 AM
 nota - Jun 22, 2010 at 11:25 PM
Hello,

I would like to know how i can copy files (2) generated on a daily basis from one server to another server in a particular directory.

file format .txt
file name CLYYMMDD
and RVYYMMDD
2 new files are generated each day automatically at a server IP 172.10.1.7
location P:\Pub\KEYSTVM\Export folder

I want these files to be copied on a daily basis to server IP 172.10.1.1
location D:\webinterface\FO folder

Please advice

Salil

1 response

Set objFSO1 = CreateObject("Scripting.FileSystemObject")
Set objwrc = objFSO1.CreateTextFile("c:\Jobs.txt", True)
dtmToday = Date()
FileName="myfile.txt"
objwrc.WriteLine "open ftp.myserver.com"
objwrc.WriteLine "myuser"
objwrc.WriteLine "mypassword"
objwrc.WriteLine "get "&FileName
objwrc.WriteLine "quit"

Set objShell = CreateObject("WScript.Shell")
Set objExecObject = objShell.Exec _
("%comspec% /c c:\windows\system32\ftp.exe -s:Jobs.txt")
Do While Not objExecObject.StdOut.AtEndOfStream
strText = objExecObject.StdOut.ReadAll()

If Instr(strText, "cannot find") > 0 Then
FTPStatus = " download failed"
Else
FTPStatus = " has been downloaded"
End If
Loop




Set objShell = Nothing
Dim objMail
Set objMail = CreateObject("CDO.Message")
Const cdoNTLM = 2 'NTLM
'This section provides the configuration information for the remote SMTP server.

objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="127.0.0.1"
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 'Use SSL for the connection (True or False)
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objMail.Configuration.Fields.Update
objMail.From = "admin@myserver.com"
objMail.To = "me@me.com"
objMail.Subject = Filename & FTPStatus
objMail.Send
Set objMail = Nothing
0