Click to See Complete Forum and Search --> : Long Filename


KfR
August 16th, 1999, 05:22 AM
I've problem with the Dir() function.
I'm working under Windows NT 4 SP 3 and VB 6, and it seem's that Dim() doesn't support long filenames.
Is it a lack of luck ?
I tried to use a FileSystemObject object to support long filenames (i hope ...), but i don't know how to list, whit a filter, all the files of a folder ... How can i do that ?

PS : Sorry for mistakes in this message ;)

<KfR>

Lothar Haensler
August 17th, 1999, 02:18 AM
AFAIK the FileSystemObject doesn't support filters. But, you could use the VB Like operator to produce a filter as in

Dim fs as Scripting.FileSystemObject
set fs = new Scripting.FileSystemObject
Dim f as Folder
set f = fs.GetFolder("c:\schrott")
Dim fl as File
for Each fl In f.Files
If ucase(fl.Name) Like "*.EXE" then
Debug.print fl.Name
End If
next fl



You could also use the API functions FindFirstFile and FindNextFile to scan all files in a directory.

August 18th, 1999, 07:33 AM
Thanks a lot for your answer !
I know now a new operator : like !! Very good ... =)

But does the FileSystemObject support long filenames ?
And is it wrong that Dir() doesn't support the m ?

<KfR>

August 18th, 1999, 08:00 AM
yes, the FileSystemObject does support long file names.
The same is true for the Dir function.
I have no idea, why it doesn't work in your installation.