Link to home
Start Free TrialLog in
Avatar of et1dkn
et1dkn

asked on

FileCopy Command VB4

I have an App which uses the FileCopy command to copy files with wildcards....i.e.    *.dll       Apparently FileCopy does not support this.  If this is so, does anyone have a workaround?
ASKER CERTIFIED SOLUTION
Avatar of jbil
jbil

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RichardE
RichardE

For some reason my Answer of earlier today does not show up - so I will submit again. jbil's answer assumes you are using a file list. I do not assume that ... so here it is again:

Sub CopyFiles()
    '-- This example copies all *.txt files in current path to a: root
    Dim sFileName     As String
    Dim sCurrentPath  As String
               
    '-- Test path for being a ROOT
    If Right(App.Path, 1) <> "\" Then
        sCurrentPath = App.Path & "\"
    Else
        sCurrentPath = App.Path
    End If
   
    '-- See if at least one file exists
    sFileName = Dir(sCurrentPath & "*.txt")
    If sFileName = "" Then
        MsgBox "No .txt files to copy"
    Else
        '-- Copy any other files that match our criteria to the ROOT of A:
        Do
            FileCopy sCurrentPath & sFileName, "A:\" & sFileName
            sFileName = Dir
            If sFileName = "" Then
                Exit Do
            End If
        Loop
    End If
             
End Sub



Avatar of et1dkn

ASKER

from et1dkn:
I posted a question on 1/2/1999..an answer was proposed by jbil and was adequate for my problem.  RichardE also proposed an answer that provided me some other useful info..but the Experts Exchange system went down blocking his answer until 1/3/1999. I would like to credit him with points also.
How do I do that?

et1dkn@aol.com

et1dkn:

I appreciate that but don't waste your time. I'll live without the 20 points. I just hope I have helped you over your little stumbling block...

I too noticed the meltdown and that's why it's a week later, besides the fact that I have to do the 40+ hours for "the man" and project delivery is near.
Avatar of et1dkn

ASKER

RichardE:
Thanks anyway. The object I was trying to reach was not as simple as the question appeared in the context of what I was trying to do......but both answers did steer me in the right direction.  Thanks again (by the way,the points were 200, but I guess the malfunction shuffled that around too)

et1dkn