Jump to content
Sign in to follow this  

error with xcopy

Recommended Posts


I found a very useful program on the net, and i am trying to modify it to make it work for my needs. The original script waits for any inserted thumbdrive and instantly dumps it's contents on the working folder of the script.

I would like to modify it to make it work for CDs instead of USB devices. I tried changing the highlighted part of the code that i'm posting, and it works.

The only problem is that it works if you already have a cd in the computer, if not you get an error that there is no cd and even if you put one later it doesn't work.

Is there a way to fix this? i would like it to start working as soon as i pop in a cd, without dialogs, and to work for more than a cd, so if one finishes copying and i put anther one, i want it to copy that one too.


ORIGINAL PROGRAM FROM IT'S WEBSITE==> http://www.irongeek.com/i.php?page=security/thumb-sucking-udf-flash-drive

ORIGINAL PROGRAM SOURCE CODE==> http://pastebin.com/t2EX9TAy

MY MODIFIED SOURCE CODE==> http://pastebin.com/1gbTS09P


Share this post

Link to post
Share on other sites

I added a check for "DriveSpaceTotal"...if there is no error, then it proceeds with the copy

#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****

Opt("TrayIconHide", 1)
$DumpDir = @WorkingDir & "\"
$OldCount = 0
While 1
    $Var = DriveGetDrive("CDROM")
    If Not @error And $Var[0] <> $OldCount Then
        For $i = 1 To $Var[0]
            Local $DiskSize = DriveSpaceTotal($Var[$i])
            If Not @error Then
                If $Var[$i] <> "a:" Then
                    $CommandString = 'xcopy ' & $Var[$i] & '\ ' & '"' & $DumpDir & DriveGetLabel($Var[$i]) & '-Dump" /EHY'
                    ;MsgBox(4096, "", $CommandString)
                    DirCreate(DriveGetLabel($Var[$i]) & "-Dump")
                    ;MsgBox(4096, "", DriveGetLabel ($var[$i]))
                    Run($CommandString, "", @SW_HIDE)
        $OldCount = $Var[0]

Share this post

Link to post
Share on other sites

That works very nice.

What happens when it encounters a CD with copyright?

And it would be sweet if it had a progress bar so you know its doing something.

Nice work


Share this post

Link to post
Share on other sites

Here is one example of a copy with progress. You can search the forum for "progresscopy" or just "progress" for others.

I'm not sure what would happen if the CD/DVD were copywright protected...I suppose that it would just never start/finsih the copying. You may include a timer to realize that the copy operation has failed.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...