Code Script .co.uk

Home | Scripts | Tutorials | Disclaimer | Sitemap | Contact

   Auto Copy Files From Cdrom
 

Vbscript / Files And Folders / Auto Copy Files From Cdrom

This is a useful little script for dumping the contents of a CDROM or DVDROM to hard drive escpecially when you have a lot to do! It will keep running and eject the CDROM when the copy of files has finished so all you need to do is keep putting in a CD or DVD every time the drive opens. You will need to end the wscript (or cscript) process using task manager to end the script or simply shut down (or restart) the computer.



Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = WScript.CreateObject("WScript.Shell")

On Error Resume Next

CD = "E:"
Dest = "r:"
pollTime = 20

Do Until false

replDir CD, Dest

CreateObject("Shell.Application").Namespace(17).ParseName(CD).InvokeVerb("E&ject")


iRetVal = objShell.Popup("Disk copy complete. Enter another disk and wait or click Cancel below to Quit",pollTime,"Idle...",vbRetryCancel + vbQuestion)

Select Case iRetVal

Case vbRetry
 

 Case vbCancel
 
 Wscript.Quit
  
End Select

Loop

Sub replDir(src, dest)

On Error Resume Next

Set objDir = objFSO.GetFolder(src)
For Each file In objDir.Files

If NOT objFSO.FileExists(dest &  "" & file.Name) Then
objFSO.CopyFile src & "" & file.Name, dest & "" & file.Name

End If

Next

If Err.Number <> 0 Then
  Wscript.Echo("Error copying " & src & " to " & dest & ". " & Err.Description)
 Err.Clear
 On Error GoTo 0
End If

For Each dir In objDir.SubFolders

If NOT objFSO.FolderExists(dest & "" & dir.Name) Then
objFSO.CreateFolder dest & "" & dir.Name
End If

replDir src & "" & dir.Name, dest & "" & dir.Name

Next
End Sub





Please note that a disclaimer applies to any code on this page.
 
   Actions
  Go Back
  Bookmark
  Print Page


   Menu
 
- Links
- Reference
- Script Editors
- Tutorials
- Vbscript
     - Active Directory
     - Exchange
     - Files And Folders
          - Auto Copy Files From Cdrom
          - Backup My Documents
          - Cleanup Filenames
          - Create Remote File Share
          - File Properties
          - File Server Report
          - File Type Report Scan
          - Find And Replace Filename Text
          - Find And Replace Text In Files
          - Folder Size Scanner
          - Rename Files Find And Remove Text
          - Rename Files Find And Replace Text
          - Replace Folder Ntfs Security Permissions
          - Simple File Report
          - Sort And Move Files To Folders
          - Windows File Locations
     - General
     - Ms Office
     - Operating System
     - Processes And Services
     - Text Processing
     - User Interaction
     - Web Servers


Keywords: CD copy, CD to HDD, CD dump, DVD copy to hard drive, auto DVD file copy,