1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
set objWMIService = GetObject ("winmgmts:")
foundProc = False
procName = "ftp.exe"
for each Process in objWMIService.InstancesOf ("Win32_Process")
If StrComp(Process.Name,procName,vbTextCompare) = 0 then
foundProc = True
procID = Process.ProcessId
End If
Next
If foundProc = True Then
Set colProcessList = objWMIService.ExecQuery("Select * from Win32_Process where ProcessId =" & procID)
For Each objProcess in colProcessList
objProcess.Terminate()
Next
WScript.Sleep(1000) 'Pause avant de relancer le check processus
Set colProcessList = objWMIService.ExecQuery("Select * from Win32_Process where ProcessId =" & procID)
If colProcessList.count = 0 Then
FichierCommandeFTP = "D:\FTP\ftptransf_Test.ftp"
FichierLogFTP = "D:\FTP\ftp_Test.log"
Set WSHShell = CreateObject("WScript.Shell")
WSHShell.CurrentDirectory = "D:\FTP"
WSHShell.Run "cmd /c ftp.exe -in -s:" & FichierCommandeFTP & " >> " & FichierLogFTP, 0 , True
Dim FSO
Set FSO = CreateObject("Scripting.FileSystemObject")
FSO.CopyFile "D:\FTP\Test\*.txt", "D:\FTP\old\Test"
'FSO.CopyFile "D:\FTP\Envoi\AFD_BL\*.csv", "D:\FTP\old\AFD_BL"
'FSO.CopyFile "D:\FTP\Envoi\AFD_FAC\*.csv", "D:\FTP\old\AFD_FAC"
End If
End If
WScript.quit |
Partager