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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with folder attributes

Status
Not open for further replies.

danl65

Programmer
Oct 29, 2008
5
US
I am working on a vbscript that is searching through the file system but I want to ignore hidden folders and special folders such as $RECYCLE.BIN.

On Windows 7 DOCUMENTS AND SETTINGS is a hidden folder and not accessible but comes up as a sub folder of the C:\ drive. Its attributes are 22, so it is hidden. So I thought I could just filter the hidden folders.

So I have the following code:
Const Hidden = 2
...

If Not (item.Attributes And Hidden) Then
g_oLogFile.WriteLine Time() & ":" & vbTab & "Searching for " & item.Name
FindItem p_strItem,item
End If

However, when an item.Attributes = 22 (2+4+16) I am still entering my If statement. Am I missing something on how to implement a check for the Hidden folder attribute?

Thank you.
 
Just run a dos command. It's leaps and bounds faster and easier to execute

Code:
dir *wonka* /a-h /b /l /on > files.txt

Find all files with the word "wonka" that don't have the hidden attribute (/a-h). Send the output (>) in lowercase (/l) to "files.txt" in bare format (/b) ordered by name (/on).

-Geates

"I hope I can chill and see the change - stop the bleed inside and feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
and check all subfolders (/s)

-Geates

"I hope I can chill and see the change - stop the bleed inside and feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top