Solved

a simple file copying utility... problem!

Posted on 1998-08-24
1
180 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 14

Accepted Solution

by:
waty earned 50 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

732 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