1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| FTPUser = "user"
FTPPass = "pwd"
FTPHost = "serveurdistant.fr"
FTPDir = "/home/user"
strFTP = "ftp://" & FTPUser & ":" & FTPPass & "@" & FTPHost & FTPDir
Set objFTP = oShell.NameSpace(strFTP)
If objFSO.FileExists(fichier) Then
Set objFile = objFSO.getFile(fichier)
strParent = objFile.ParentFolder
Set objFolder = oShell.NameSpace(strParent)
Set objItem = objFolder.ParseName(objFile.Name)
if objFTP.FileExists(objFTP.objItem.Name) then
objFTP.DeleteFile objItem.Name
objFTP.CopyHere objItem, copyType
else
objFTP.CopyHere objItem, copyType
End If
End If |
Partager