Solved

FileCopy Command VB4

Posted on 1999-01-02
5
282 Views
Last Modified: 2012-05-04
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?
0
Comment
Question by:et1dkn
  • 2
  • 2
5 Comments
 
LVL 3

Accepted Solution

by:
jbil earned 200 total points
ID: 1453626
Private Sub Command1_Click()
Dim i
For i = 0 To File1.ListCount - 1
If File1.List(i) Like "*.myext" Then
FileCopy File1.List(i), "mycopy of" & File1.List(i)
End If
Next

End Sub
0
 
LVL 1

Expert Comment

by:RichardE
ID: 1453627
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



0
 

Author Comment

by:et1dkn
ID: 1453628
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

0
 
LVL 1

Expert Comment

by:RichardE
ID: 1453629
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.
0
 

Author Comment

by:et1dkn
ID: 1453630
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

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
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…

910 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

20 Experts available now in Live!

Get 1:1 Help Now