title: Create backup folder with several directories and files
body: <p>I am new at this and I am trying to get a VBScript (Because the aplicattion only works with this) tha makes a backup of several directories and files...</p>
  
  <p>EXample:</p>
  
  <pre><code>Check if Folder1 exist... (It may be on c:\ or another drive)
  If don´t exist the finish
  If exist than should create a Bck Folder
  THan Backup the folders that are inside folder1 (Folder2, Folder3)
  Also backup all the files that are *.mds, *.vbs inside Folder4
  The script have to maintain the struture...
  And after that delete all folder1
  </code></pre>
  
  <p>This is what I have so far:</p>
  
  <pre><code>IF NOT EXIST "%INSTALLDIR%\Folder1\" GOTO ENDPROG 
  mkdir "%INSTALLDIR%\BCK\" 
  mkdir "%INSTALLDIR%\BCK\DADOS\" 
  mkdir "%INSTALLDIR%\BCK\IMAGEM\" 
  mkdir "%INSTALLDIR%\BCK\CONFIG\" 
  mkdir "%INSTALLDIR%\BCK\OFFBck" 
  copy "%INSTALLDIR%\Folder1\Dados*.MDB" "%INSTALLDIR%\BCK\dados\" 
  copy "%INSTALLDIR%\Folder1\Dados*.MDD" "%INSTALLDIR%\BCK\dados\" 
  copy "%INSTALLDIR%\Folder1\Dados*.VEI" "%INSTALLDIR%\BCK\dados\" 
  copy "%INSTALLDIR%\Folder1\Imagem*.*" "%INSTALLDIR%\BCK\Imagem\" 
  copy "%INSTALLDIR%\Folder1*.cfg" "%INSTALLDIR%\BCK\Config\" 
  copy "%INSTALLDIR%\Folder1\OFFbck*.ZIP" "%INSTALLDIR%\BCK\OFFbck\" 
  copy "%INSTALLDIR%\Folder1\Folder1\OFFbck*.ZIP" "%INSTALLDIR%\BCK\OFFbck\" 
  rmdir "%INSTALLDIR%\Folder1" /s /q 
  :ENDPROG 
  </code></pre>
  
  <p>Can anyone give me a hand on this?</p>
  
  <p>I already did this.....But i give an error if the folder already exist for the backup....but I cannot start to copy....</p>
  
  <pre><code>Set objFSO = CreateObject("Scripting.FileSystemObject")
  
  If objFSO.FolderExists("C:\Folder1") Then
      Set objFSO = CreateObject("Scripting.FileSystemObject")
      Const OverwriteExisting = TRUE
      Set objFolder = objFSO.CreateFolder("C:\BCK")
      Set objFolder = objFSO.CreateFolder("C:\BCK\Imagem")
      Set objFolder = objFSO.CreateFolder("C:\BCK\dados")
      Set objFolder = objFSO.CreateFolder("C:\BCK\config")
      Set objFolder = objFSO.CreateFolder("C:\BCK\off")
  Else
  End If
  </code></pre>
  
  <p>Thanks in advance</p>
  
  <p>I just created this....</p>
  
  <pre><code>Set objFSO = CreateObject("Scripting.FileSystemObject")
  
  If objFSO.FolderExists("C:\audatex") Then
      Const OverwriteExisting = True
      Set objFSO = CreateObject("Scripting.FileSystemObject")
      Set objFolder = objFSO.CreateFolder("C:\BCK")
      Set objFolder = objFSO.CreateFolder("C:\BCK\Imagem")
      Set objFolder = objFSO.CreateFolder("C:\BCK\dados")
      Set objFolder = objFSO.CreateFolder("C:\BCK\WTB")
      Set objFolder = objFSO.CreateFolder("C:\BCK\CFG")
      Set objFolder = objFSO.CreateFolder("C:\BCK\config")
      Set objFolder = objFSO.CreateFolder("C:\BCK\offdaten")
      Set objFSO = CreateObject("Scripting.FileSystemObject")
      objFSO.CopyFile "C:\Audatex\offdaten\*.zip" , "c:\BCK\Offdaten\" , OverwriteExisting
      Set objFSO = CreateObject("Scripting.FileSystemObject")
      objFSO.CopyFile "C:\Audatex\Dados\*.vei" , "c:\BCK\dados\" , OverwriteExisting
      Set objFSO = CreateObject("Scripting.FileSystemObject")
      objFSO.CopyFile "C:\Audatex\Dados\*.mdd" , "c:\BCK\dados\" , OverwriteExisting
      Set objFSO = CreateObject("Scripting.FileSystemObject")
      objFSO.CopyFile "C:\Audatex\*.cfg" , "c:\BCK\CFG\" , OverwriteExisting
      Set objFSO = CreateObject("Scripting.FileSystemObject")
      objFSO.CopyFile "C:\Audatex\Dados\*.mdb" , "c:\BCK\dados\" , OverwriteExisting
      Set objFSO = CreateObject("Scripting.FileSystemObject")
      objFSO.CopyFolder "C:\Audatex\Imagem" , "c:\BCK\Imagem" , OverwriteExisting
      Set objFSO = CreateObject("Scripting.FileSystemObject")
      objFSO.CopyFile "C:\Audatex\WTB\*.wtb" , "c:\BCK\WTB\" , OverwriteExisting
      Set objFSO = CreateObject("Scripting.FileSystemObject")
      objFSO.CopyFile "C:\Audatex\WTB\*.dtb" , "c:\BCK\WTB\" , OverwriteExisting
  End IF  
  </code></pre>
  
  <p>But know I have the following problems: If there is nothing on the folders i got an error and i cannot overwrite the folders</p>
  
  <p>Thanks</p>