title: print all files in folder and then remove them
body: <p>I am creating a web-based Point of Sale, and right now I am getting stuck with the VBScript.</p>
  
  <p>The script should be printing all files in the selected folder, and after that I want to remove the files printed.
  The selected folder will only contain PDF files that are going to be printed.</p>
  
  <p>This is my current code: </p>
  
  <pre><code>TargetFolder = "C:\Users\pos\Downloads\"
  If TargetFolder &gt; "" Then
    Set objShell = CreateObject("Shell.Application")
    Set objFolder = objShell.Namespace(TargetFolder) 
    Set colItems = objFolder.Items
    For Each objItem in colItems
      objItem.InvokeVerbEx("Print")
      Set fso = CreateObject("Scripting.FileSystemObject")
      Set MyFile = fso.GetFile(TargetFolder+objItem)
      MyFile.Delete
    Next
  Else
    Wscript.Quit
  End If
  </code></pre>
  
  <p>All files are printed if I remove the remove file part, With the remove files it will delete all files before they get printed.</p>
  
  <p>So what I want is to print the files, and remove them once they are printed.</p>