473,396 Members | 2,020 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Dir(strPath, +R +A +S +H) keeps returning hidden folders

Hi Gang,
All I want is to be able to search a file for files matching a certain
criteria. However, VB seems heart set on returning hidden folders
along with my list of files. I've tried the following:
strFile = Dir(strPath, FileAttribute.Archive Or FileAttribute.Hidden Or
FileAttribute.ReadOnly Or FileAttribute.System)

and this which shouldn't be necessary

strFile = Dir(strPath, FileAttribute.Archive Or FileAttribute.Hidden Or
FileAttribute.ReadOnly Or FileAttribute.System AND
FileAttribute.Directory)

Either way I still turn up my hidden ".svn" subfolder. (The folder is
hidden only, that is it's the only attribute, it's not system or
anything else).

I realize I could then do System.IO.File.Exists(strPath) to make sure
it's actually a file, but that would double the disk access. Pretty
lame if you ask me :).

Thanks for any and all help regarding this matter,
Christian Blackburn

Jan 5 '06 #1
3 2322
Hi,

Why not use the system.io.directoryinfo class to get the files. You
can specify a search pattern for the files.

Dim fi As System.IO.FileInfo
Dim di As New
System.IO.DirectoryInfo(Environment.GetFolderPath( Environment.SpecialFolder.MyDocuments))
For Each fi In di.GetFiles("*.ppt")
Trace.WriteLine(fi.Name)
Next

Ken
-------------------
"Christian Blackburn" <my*********@Yahoo.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Hi Gang,
All I want is to be able to search a file for files matching a certain
criteria. However, VB seems heart set on returning hidden folders
along with my list of files. I've tried the following:
strFile = Dir(strPath, FileAttribute.Archive Or FileAttribute.Hidden Or
FileAttribute.ReadOnly Or FileAttribute.System)

and this which shouldn't be necessary

strFile = Dir(strPath, FileAttribute.Archive Or FileAttribute.Hidden Or
FileAttribute.ReadOnly Or FileAttribute.System AND
FileAttribute.Directory)

Either way I still turn up my hidden ".svn" subfolder. (The folder is
hidden only, that is it's the only attribute, it's not system or
anything else).

I realize I could then do System.IO.File.Exists(strPath) to make sure
it's actually a file, but that would double the disk access. Pretty
lame if you ask me :).

Thanks for any and all help regarding this matter,
Christian Blackburn

Jan 5 '06 #2
Hi Ken,

That's just too easy, you make me sick :). No just kidding that's
great. I was trying for good performance though. However, I like the
code and think I will use it in my search application, since in that I
would be interested in all those file properties. Oh and I can also
use it in my indexing page
http://www.christianblackburn.com/misc/default.asp (obviously, I still
need to convert this to ASP 2.0). Thanks for your help, you probably
don't remember me, but I know you've helped me on a number of
occasions. Possibly even in the VB6 group :).

Cheers,
Christian Blackburn

Jan 5 '06 #3
Hi Ken,

That's just too easy, you make me sick :). No just kidding that's
great. I was trying for good performance though. However, I like the
code and think I will use it in my search application, since in that I
would be interested in all those file properties. Oh and I can also
use it in my indexing page
http://www.christianblackburn.com/misc/default.asp (obviously, I still
need to convert this to ASP 2.0). Thanks for your help, you probably
don't remember me, but I know you've helped me on a number of
occasions. Possibly even in the VB6 group :). That's doen't look
recursive though, which is fine I can do recursion.

Cheers,
Christian Blackburn

Jan 5 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: ebobnar | last post by:
I'm having trouble navigating my directory structure using php's ftp functions (such as ftp_chdir and ftp_cdup.) I'm writing a program that allows a user to easily create robot.txt files and upload...
8
by: Pat | last post by:
Hi, I'm pulling my hair out here over this one... The following line of code: Msgbox Dir("c:\test\", vbDirectory) Is returning the names of files in the directory instead of other...
3
by: rbt | last post by:
How do I enable the hidden attribute when creating files on Windows computers? I'd *really* prefer to do from the standard Python installer (no win32 extensions). Any tips? Thanks
19
by: Badr.ALmuzini | last post by:
hi,there how can i make php file extension hidden in the URL somthing like this (http://mail.google.com/mail/?view) Regard....
4
by: manontheedge | last post by:
I'm using Dir() which is built into VB6, in order to go to a folder and find the names of all the files in that folder. It's extremely simple. BUT, it won't tell me what folders are in the...
6
by: Curious | last post by:
In a given folder, there are many sub-folders. Is there an easy way to find out those sub-folders that don't contain any file (empty sub- folders)? Is there such a utility in .NET?
1
by: Sam | last post by:
This is probably the wrong group to post this in, but I'm not sure where it should go. If you have suggestions as to another group to post it let me know. In our Nant build file for our...
4
by: Giampaolo Rodola' | last post by:
I was reading os.readlink doc which says: readlink( path) Return a string representing the path to which the symbolic link points. The result may be either an absolute or relative pathname; if...
6
by: veer | last post by:
the programe is about i have one folder named newdata which contain 46 folders and each folder containg multiple mdb files and with in mdb files there are two tables. i want to merge all these...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.