Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

a simple file copying utility... problem!

Posted on 1998-08-24
1
Medium Priority
?
188 Views
Last Modified: 2010-04-30
Hi guys,
   I am trying to create a simple file copying utility program that copies ALL files from a single directory and sents it to A:> ..Once it fills up the diskette , it is supposed to prompt the user to insert a new diskette and resume copying... however I cannot specify the wildcard
*.* as the files to be copies.... how do I rectify the problem and will my app. be able to commence copying after the disk prompt... I have included the code for you experts to look at ( and correct :)) .. thanks a lot!!!

The code....

Dim SourceFile, DestinationFile ' declare
On Error GoTo ErrorHandler ' catch error
SourceFile = "c:\temp\*.*"  ' <-- the problem *.*!!!
DestinationFile = "a:\*.*"

FileCopy SourceFile, DestinationFile    ' Copy source to target.
MsgBox ("File copying completed.")
End
ErrorHandler:   ' Error-handling routine.
    Select Case Err.Number  ' Evaluate error number.
        Case ...
            < Abort copying and end program >
        Case 61  ' Prompt for new disk if disk full
            MsgBox ("Disk full. Please enter another disk.")
            Resume  ' will it continue copying from last point?
    End Select

-- end of code summary --

Bye!!

david
0
Comment
Question by:Haho2
1 Comment
 
LVL 14

Accepted Solution

by:
waty earned 200 total points
ID: 1430627
You have 2 possibilities :
  - make a shell to XCopy

  - Write it in VB :

Private Sub CopyFiles(sStart As String, sDest As String)
   ' *** Copy files from start to dest
   
   Dim sFile      As String
   
   On Error GoTo ErrorHandler ' catch error

   ' *** Start with all files
   sFile = Dir(sStart & "\*.*", vbNormal)
   Do While sFile <> ""
      FileCopy sStart & "\" & sFile, sDest & "\" & sFile
      sFile = Dir()
   Loop
   

   MsgBox ("File copying completed.")
   End

ErrorHandler:   ' Error-handling routine.
    Select Case Err.Number  ' Evaluate error number.
        Case ...
            < Abort copying and end program > 
        Case 61  ' Prompt for new disk if disk full
            MsgBox ("Disk full. Please enter another disk.")
            Resume  ' will it continue copying from last point?
    End Select

End Sub

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question