dgb001
asked on
Get default drive and list files and files in subfolders
Hi,
Without using a DriveBox or FileList box, and also without using Microsoft's new filesysinfo dll (or whatever it's called, which ships with VB6) I want to be able to ascertain the users default drive, and get the name of each *.bmp file in that drive and in all subfolders.
Many thanks,
Dave
Without using a DriveBox or FileList box, and also without using Microsoft's new filesysinfo dll (or whatever it's called, which ships with VB6) I want to be able to ascertain the users default drive, and get the name of each *.bmp file in that drive and in all subfolders.
Many thanks,
Dave
ASKER
OK, thx, I'll take a look and let you know.
Cheers,
Dave
Cheers,
Dave
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok, let me have a read and play with it and I'll get back to you.
Many thx,
Dave
Many thx,
Dave
ASKER
Hi,
Just a couple of things:
a) I seem to get a "User-defined type not defined" on the first line when it tries to Dim clsFile
b) I notice that you defaulted it to use C:\ - is there a way to find out if that is indeed the default drive ?
Many thx,
Dave
Just a couple of things:
a) I seem to get a "User-defined type not defined" on the first line when it tries to Dim clsFile
b) I notice that you defaulted it to use C:\ - is there a way to find out if that is indeed the default drive ?
Many thx,
Dave
you need the class file called clsFile
Oops remove the line..
Dim File As New clsFile
and change the function call from..
Call File.ListFiles("C:\", x, True, True, "*.bmp")
to..
Call ListFiles("C:\", x, True, True, "*.bmp")
Dim File As New clsFile
and change the function call from..
Call File.ListFiles("C:\", x, True, True, "*.bmp")
to..
Call ListFiles("C:\", x, True, True, "*.bmp")
To get the current drive you can use the CurDir variable, where the current drive is Left$(CurDir, 3)
ASKER
Okey dokey - let me play around and I'll get back to you.
Thx for your help,
Dave
Thx for your help,
Dave
ASKER
Thx,
Dave
Dave
Sorry for the lack of input (no example) but the computer i'm on doesn't have VB installed on it.
The idea is to do a loop, using Dir() to get a filename, checking the return type to see ie it's a DIR or FILE, then if it's a file, do
if (right(filename, 4) = ".bmp") then
again, sorry that i cannot give an example, but i could do if you want me to, just say so :)