?
Solved

FileCopy Command VB4

Posted on 1999-01-02
5
Medium Priority
?
292 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
[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
  • 2
  • 2
5 Comments
 
LVL 3

Accepted Solution

by:
jbil earned 800 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
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…
Suggested Courses

718 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