| | | Forum Newbie
       
Group: Forum Members Last Login: 3/29/2005 4:31:00 PM Posts: 2, Visits: 1 |
| I have to look through a particular network folder to find a file then copy it to another network share. I have the format of the file name, but I need to do a wildcard search through the folder to get the complete filename before I can use "filecopy sourcefile, destinationfile" What is the code for finding a file that lets me use wildcards? Thanks,
K |
| | | | Forum Member
       
Group: Forum Members Last Login: 2/28/2006 11:41:01 AM Posts: 48, Visits: 3 |
| Don't know about FileCopy but the File System Object would do the trick. Private Sub Command1_Click() Dim fso As FileSystemObject Set fso = New FileSystemObject fso.CopyFile "C:\*.mdb", "C:\Testit\" MsgBox "Done!", vbInformation End Sub
Swi |
| | | | 
Forum God
       
Group: Forum Members Last Login: Yesterday @ 1:10:14 PM Posts: 1,502, Visits: 3,491 |
| FileCopy copies a file to an other folder. FileCopy "C:\Windows\Calc.exe, "C:\Temp\Calc.exe" He was asking how to find a file. 
Keithhttp://www.martin2k.co.uk/forums/ I've been programming with VB for 12 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning. |
| | | | Forum Member
       
Group: Forum Members Last Login: 2/28/2006 11:41:01 AM Posts: 48, Visits: 3 |
| Quite an oversite. Should have read the whole post. Look up the DIR function in VB help and it will give you a good example of using wildcards.
Swi |
| | | | 
Forum God
       
Group: Forum Members Last Login: Yesterday @ 1:10:14 PM Posts: 1,502, Visits: 3,491 |
| Yes he wants to find a file then copy it. You code doesn't find anything. 
Keithhttp://www.martin2k.co.uk/forums/ I've been programming with VB for 12 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning. |
| | | | Forum Newbie
       
Group: Forum Members Last Login: 3/29/2005 4:31:00 PM Posts: 2, Visits: 1 |
| You're both right. I was asking about finding a filename using wildcards so I could use the filecopy the way I outlined it in the original post. However, I was also open to any other ways of accomplishing the same task. I seems so simple a task, I thought it was just my VB rust getting in the way. How would I go about doing a wildcard search for a filename then copying the file I found to another network location? I don't appear to have access in my program to filesystemobjects or the methods for them, if that's the right terminology. Thanks
K |
| | | | Forum Member
       
Group: Forum Members Last Login: 2/28/2006 11:41:01 AM Posts: 48, Visits: 3 |
| | |
|
|