TIP: Click on subject to list as thread! ANSI
echo: visual_basic
to: All
from: Eric
date: 2004-06-17 09:46:00
subject: Re: Visual Basic File Con

Adrian Birkett  wrote in message
news:...
> Mike wrote:
> 
> >Okay!! I want to copy the entire files in a directory to another
> >directory.
> >
> >Heres the code:
>
>--------------------------------------------------------------------------------
> >
> >Private Sub Command1_Click()    
> >   MsgBox File1.FileName 
> >End Sub
> >
> >Private Sub Dir1_Change()    
> >   File1.Path = Dir1.Path
> >End Sub
> >
>
>--------------------------------------------------------------------------------
> >
> >
> >Okay, As you can see it only shows one file name. I want it to do a
> >wildcard copy. Anyone know how to do that??? (From one directory to
> >another)
> >
> >PS and File1 is going to be invisible
> >
> 
> OK, off the top of my head without any testing...
> 
> dim to_dir as string, from_dir as string, filename as string
> 
> from_dir = "c:\my_from_dir\"
> to_dir = "c:\my_to_dir"
> 
> filename = dir(from_dir & "*.*")
> do while filename  ""
>     name from_dir & filename as to_dir & filename
>     filename = dir()
>     doevents
> loop
> 
> or something like that anyway
> 
> Regards,
> 
> Ade



Dim fromDir As String
Dim toDir As String

File1.Path = fromDir

For I = 0 To File1.ListCount - 1

    If Right(App.Path, 1) = "\" Then
        toDir = App.Path & File1.ListIndex(I)
    Else
        toDir = App.Path & "\" & File1.ListIndex(I)
    End If

    r = Copy(fromDir, toDir)

Next I

Eric
---
þ RIMEGate(tm)/RGXPost V1.14 at BBSWORLD * Info{at}bbsworld.com

---
 * RIMEGate(tm)V10.2áÿ* RelayNet(tm) NNTP Gateway * MoonDog BBS
 * RgateImp.MoonDog.BBS at 6/17/04 9:46:11 AM
* Origin: MoonDog BBS, Brooklyn,NY, 718 692-2498, 1:278/230 (1:278/230)
SEEN-BY: 633/267 270
@PATH: 278/230 10/345 106/1 2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.