Solved

FileCopy Command VB4

Posted on 1999-01-02
5
280 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…

747 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

12 Experts available now in Live!

Get 1:1 Help Now