Jump to content

Problems With Dircopy


Recommended Posts

DirCopy will return an error every time if I give it the source and dest with variables, if I give it the same locations as simple strings, it works... but if I wanted it hard coded, I'd just make a looping bat file... (heh, like I can tell my users to do anything at a command line...)

Do
   $source = FileSelectFolder("Select the drive to copy files from." & @CR & "This should be your removable media such as a floppy or CD drive", "", 0)
      if @error = 1 then exit
   $dest = FileSelectFolder("Select the destination for the files" & @CR & "This should be your network location like a folder on the I drive", "", 1)
      if @error = 1 then exit
   $confirm = MsgBox(3, "Confirm Copy", "This will copy all files from " & $source & " to " & $dest & @CR & "Are you sure?") 

   If $confirm = 2 then exit

Until $confirm = 6

Do

   MsgBox(0, "Insert Disk", "Insert disk to copy." & @CR & "This will copy all files from " & $source & " to " & $dest,"") 
   DirCopy($source,$dest,0)
   if @error = 0 then MsgBox(0, "error","there was a problem.  check it out","")
   $another = MsgBox(4, "Copy another?", "Would you like to copy another disk to the same location?","")

Until $another = 7
Edited by emmanuel

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

  • Developers

don't think you are testing correctly.... you test @error but the helpfile says return value...

Shouldn't it be this way??

$rc = DirCopy($SOURCE,$DEST,0)
If $rc = 0 Then MsgBox(0, "error","there was a problem.  check it out","")

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

thanks, didn't realize the difference. it's still not copying files.

I tried it without the FileSelectFolder and all that other jazz, like this:

$source = "A:\"
$dest = "C:\TEMP\"
   
   DirCopy( "A:\" , "C:\TEMP\" , 0 )

just figured it out... having the overwrite set to 0 meant that it wouldn't even copy the files into the folder as long as the folder existed...

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...