Jump to content

Copy Files From Removable Media To A Network Drive


Recommended Posts

I'd know how to do this with goto's and when I picked through the help file, I thought the functions replaced that, so it seemed simple and here's what I tried... and it simply doesn't do anything.

I've got some users with about 300 floopies that need to get coppied to the network, the files all have different names, so there's no need to not just dump it all in the same location...

I beg of you, tell me what I'm doing wrong?

Func sourcedest ()
   $source = FileSelectFolder("Select the drive to copy files from." & @CR & "This should be your removable media such as a floppy or CD drive", "A:", 0)
   $dest = FileSelectFolder("Select the destination for the files" & @CR & "This should be your network location like a folder on the I drive", "I:", 0)
   $confirm = MsgBox(3, "Confirm Copy", "This will copy all files from " & $source & " to " & $dest & @CR & "Are you sure?") 
   If $confirm = 2 then exit
   If $confirm = 7 then Call("soucedest")
   If $confirm = 6 then Call("copyfiles")
EndFunc

Func copyfiles ()
   MsgBox(0, "Insert Disk", "Insert disk to copy." ,"") 
   DirCopy($source, $dest, 0)
   Call ("again")
EndFunc

Func again ()
   $another = MsgBox(4, "Copy another?", "Would you like to copy another disk to the same target?","")
      If $another = 7 then Exit
      If $another = 6 then Call("copyfiles")

EndFunc

Call ("soucedest")

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

Link to comment
Share on other sites

I suppose the alternate title to this question is "How do I perform repetative tasks?" that broadens it out to more than just this one task...

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

Link to comment
Share on other sites

  • Developers

FUNC is realy a subroutine .... or in other words stript logic you put somewhere else and call it everytime.

To do a repeatitive task you can do:

Do
  ; logic
Untill $a=1

For $x = 1 to 1000
  ; logic
Next

While 1
  ; your logic
   If $stop = 1 then exit loop
Wend

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! that got my brain into gear... though now I can't seem to get the dircopy to take the variables and copy the files... I see the path names in the confirm msgbox, so why doesn't the dircopy work?

though, it's not actually copying anything...

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", "", 0)
      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." ,"") 
   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 target?","")

Until $another = 7

"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...