title: vbs script to send files via ftp and check/delete original files
body: <p>I'm trying to send files over ftp and afterwards check if the process was completed successfully, if it was I would delete the original files and keep only the ones sent in the destination folder on FTP.</p>
  
  <p>I managed to patch up a script that connects to FTP and sends the files, but I'm not sure how to cross check original folder with the one on the FTP so I could determine if the copy was successful.</p>
  
  <p>This is the code to send files over FTP, and in testing it sends successfully all the files, but I have to check before deletion </p>
  
  <pre><code>Set oShell = CreateObject("Shell.Application")
  Set objFSO = CreateObject("Scripting.FileSystemObject")
  
  path = "D:\test\"
  
  FTPUpload(path)
  Sub FTPUpload(path)
  
  On Error Resume Next
  
  Const copyType = 16
  
  'FTP Wait Time in ms
  waitTime = 80000
  
  FTPUser = "test"
  FTPPass = "testtest"
  FTPHost = "ftp.test.com"
  FTPDir = "/htdocs/test/"
  
  strFTP = "ftp://" &amp; FTPUser &amp; ":" &amp; FTPPass &amp; "@" &amp; FTPHost &amp; FTPDir
  Set objFTP = oShell.NameSpace(strFTP)
  
  
  'Upload single file       
  If objFSO.FileExists(path) Then
  
  Set objFile = objFSO.getFile(path)
  strParent = objFile.ParentFolder
  Set objFolder = oShell.NameSpace(strParent)
  
  Set objItem = objFolder.ParseName(objFile.Name)
  
  Wscript.Echo "Uploading file " &amp; objItem.Name &amp; " to " &amp; strFTP
   objFTP.CopyHere objItem, copyType
  
  
  End If
  
  
  'Upload all files in folder
  If objFSO.FolderExists(path) Then
  
  'Entire folder
  Set objFolder = oShell.NameSpace(path)
  
  Wscript.Echo "Uploading folder " &amp; path &amp; " to " &amp; strFTP
  objFTP.CopyHere objFolder.Items, copyType
  
  End If
  
  
  If Err.Number &lt;&gt; 0 Then
  Wscript.Echo "Error: " &amp; Err.Description
  End If
  
  'Wait for upload
  Wscript.Sleep waitTime
  
  End Sub
  </code></pre>
  
  <p>I would appreciate any kind of help, thank you.</p>