Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem on file patterns

Status
Not open for further replies.

Orcho

Programmer
Oct 20, 1998
6
0
0
AR
I need to use this "*R.xxx" file pattern, but the file list box didn't give me only the files that matched the pattern, it gave me all the files ending with .xxx, so Where is de *R ?, Help me. I'm from argentine and i prefer to read i spanish if it's possible. Thanks.
 
Orcho,<br>
<br>
Sorry, cannot oblige your request for Spanish. About all I know is 'Hola' y 'digame'.<br>
<br>
Long time since I worked with a file mask in VB, but I think that using the '*' in front of the 'R' conceals the 'R' from VB's limited file access capability. I'll do some testing to be certain, and let you know what I find. Also want to go back and look at an _old_ project (VB 2.0) to see if this has changed.<br>
<br>
Manana, mas o menos.<br>
<br>

 
Orcho,<br>
<br>
I just tried both the Drive, Dir, File controls and the DIR$ Function. Had a good return on both. Maybe you could provide a sample of the code you are using for us to see? Maybe some other thing is causing a probelm.<br>
<br>
Make a good day . . .<br>

 
Here I send you the part of the code where I found the problem, <br>
<br>
File1.Path = b$<br>
File1.Pattern = "*R.QXD" <br>
c = File1.ListCount<br>
If (c) Then<br>
For p = 0 To c - 1<br>
Kill b$ + "\" + UCase$(File1.List(p))<br>
Registra_Depuración ("Borrado de (*R.QXD)")<br>
Next p<br>
End If<br>
<br>
Thanks for all you are doing, <br>
<br>
Have a nice week. Orcho.
 
Orcho,<br>
<br>
I apologize for being late - I thought I had responded to this, but I think a power problem killed my response, and I did not come back to check - mea culpa.<br>
<br>
The only thing I see that might be a problem in the code above is that the 'Kill" line will fail if b$ is the root of a drive, e.g. "C:\". You might want to preface the statement with<br>
<br>
If Right$(b$,1)&lt;&gt;"\" then<br>
b$ = b$ & "\"<br>
End If<br>
then issue the Kill statement<br>
<br>
However, there is one other item, which you have probably found by now if it is a problem. Should <br>
File1.Path=b$<br>
be changed to <br>
b$=File1.Path<br>
?<br>
<br>
Otherwise, b$ is not set, unless in code previous to this.<br>
<br>

 
Doing *R.QXD will not work on all operating systems. The Dir$ command is just passed along to the operating system. I think Windows 95 OSR2 and up will support this feature.<br>
<br>
David Finkelstein<br>
- The source for Visual Basic Source Code
 
One more thing. If you know that the filename is always eight characters you can do this:<br>
<br>
"???????R.QXD" <br>
<br>
and that should return the files you want in all operating systems (even all the way back to DOS 4.0).
 
Actually I save the problem whit an Instr command, asking for "R.", in the path string. It works very good.<br>
<br>
Thanks for all you've done. Orcho
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top