title: How to avoid "permission denied" when copying damaged files?
body: <p>I write a VBScript to copy file from E drive to C drive. There are many system files and damaged files in E drive, so when copy these files, the script will stop. Any method to pass or skip these files when the script is running?</p>
  
  <p>the code is to copy all folders from E drive to C drive</p>
  
  <pre><code>Const hd = "E:\"
  Const cd = "C:\"
  
  Dim path
  
  
  
  Sub GenPath()
  path = cd 
  
  End Sub
  
  Sub GenFolder()
  Set objFso = CreateObject("Scripting.FileSystemObject")
  objFso.CreateFolder path
   Set objFso = Nothing
  
  End Sub
  
  Set fso=WScript.CreateObject("scripting.filesystemobject")
  Set fs=fso.GetFolder("E:\")
  Set f=fs.SubFolders
  For Each uu In f
  
              Set Ws = WScript.CreateObject("Scripting.filesystemobject")
              Ws.CopyFolder  uu,path &amp; "\"
  </code></pre>