Solved

a simple file copying utility... problem!

Posted on 1998-08-24
1
175 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 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
VBA to format 3 80
Problem to delete range 4 55
how to open Waze.com/livemap from address saved in DB? 26 152
Use Multiple Forms 4 38
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

758 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now