Home > Archive > Visual Basic > May 2004 > Counting Files & Sub-Folders in a Folder
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Counting Files & Sub-Folders in a Folder
|
|
| Syed Zeeshan Haider 2004-05-30, 10:30 am |
| Hello Experts,
I have VB6EE on Win98SE.
Once somebody pointed to some API and other code chunks on web for counting
files and sub-folders in a folder. I have accidentally lost those links.
Could somebody point me to them?
Thank you,
--
Syed Zeeshan Haider
--------------------------------------------------
http://szh.20m.com
http://gomusharrafgo.20m.com
| |
| Randy Birch 2004-05-30, 10:30 am |
| http://vbnet.mvps.org/code/fileapi/countfiles.htm
--
Randy Birch
MVP Visual Basic
http://vbnet.mvps.org/
Please respond only to the newsgroups so all can benefit.
"Syed Zeeshan Haider" <szhatforumsNoVirusAndJunk@hotpop.com> wrote in
message news:ePokAakREHA.2936@TK2MSFTNGP12.phx.gbl...
: Hello Experts,
: I have VB6EE on Win98SE.
:
: Once somebody pointed to some API and other code chunks on web for
counting
: files and sub-folders in a folder. I have accidentally lost those links.
: Could somebody point me to them?
:
: Thank you,
: --
: Syed Zeeshan Haider
:
:
:
: --------------------------------------------------
: http://szh.20m.com
: http://gomusharrafgo.20m.com
:
:
| |
| Syed Zeeshan Haider 2004-05-30, 11:30 am |
| Thanks, Randy!
"Randy Birch" wrote in message news:uTrYZhkREHA.2216@TK2MSFTNGP12.phx.gbl...
> http://vbnet.mvps.org/code/fileapi/countfiles.htm
>
> --
>
> Randy Birch
> MVP Visual Basic
> http://vbnet.mvps.org/
> Please respond only to the newsgroups so all can benefit.
>
>
> "Syed Zeeshan Haider" <szhatforumsNoVirusAndJunk@hotpop.com> wrote in
> message news:ePokAakREHA.2936@TK2MSFTNGP12.phx.gbl...
> : Hello Experts,
> : I have VB6EE on Win98SE.
> :
> : Once somebody pointed to some API and other code chunks on web for
> counting
> : files and sub-folders in a folder. I have accidentally lost those links.
> : Could somebody point me to them?
> :
> : Thank you,
> : --
> : Syed Zeeshan Haider
> :
> :
> :
> : --------------------------------------------------
> : http://szh.20m.com
> : http://gomusharrafgo.20m.com
> :
> :
>
| |
| Syed Zeeshan Haider 2004-05-30, 11:30 am |
| Thanks, Randy!
"Randy Birch" wrote in message news:uTrYZhkREHA.2216@TK2MSFTNGP12.phx.gbl...
> http://vbnet.mvps.org/code/fileapi/countfiles.htm
>
> --
>
> Randy Birch
> MVP Visual Basic
> http://vbnet.mvps.org/
> Please respond only to the newsgroups so all can benefit.
>
>
> "Syed Zeeshan Haider" <szhatforumsNoVirusAndJunk@hotpop.com> wrote in
> message news:ePokAakREHA.2936@TK2MSFTNGP12.phx.gbl...
> : Hello Experts,
> : I have VB6EE on Win98SE.
> :
> : Once somebody pointed to some API and other code chunks on web for
> counting
> : files and sub-folders in a folder. I have accidentally lost those links.
> : Could somebody point me to them?
> :
> : Thank you,
> : --
> : Syed Zeeshan Haider
> :
> :
> :
> : --------------------------------------------------
> : http://szh.20m.com
> : http://gomusharrafgo.20m.com
> :
> :
>
| |
| Syed Zeeshan Haider 2004-05-30, 11:30 am |
| I have some questions about the code given at
http://vbnet.mvps.org/code/fileapi/countfiles.htm.
Why are same declarations repeated in bas module and form module?
I haven't seen this kind of constant/variable declaration before:
(Yes, I am learning VB on self-learning basis. ;-)
Private Const FILE_ATTRIBUTE_ALL As Long = FILE_ATTRIBUTE_READONLY Or _
FILE_ATTRIBUTE_HIDDEN Or _
FILE_ATTRIBUTE_SYSTEM Or _
FILE_ATTRIBUTE_ARCHIVE Or _
FILE_ATTRIBUTE_NORMAL
What is the "Or" operator for?
What would be the "And" operator mean, if used?
Thank you,
--
Syed Zeeshan Haider
--------------------------------------------------
http://szh.20m.com
http://gomusharrafgo.20m.com
"Randy Birch" <rgb_removethis@mvps.org> wrote in message
news:uTrYZhkREHA.2216@TK2MSFTNGP12.phx.gbl...
> http://vbnet.mvps.org/code/fileapi/countfiles.htm
>
> --
>
> Randy Birch
> MVP Visual Basic
> http://vbnet.mvps.org/
> Please respond only to the newsgroups so all can benefit.
>
>
> "Syed Zeeshan Haider" <szhatforumsNoVirusAndJunk@hotpop.com> wrote in
> message news:ePokAakREHA.2936@TK2MSFTNGP12.phx.gbl...
> : Hello Experts,
> : I have VB6EE on Win98SE.
> :
> : Once somebody pointed to some API and other code chunks on web for
> counting
> : files and sub-folders in a folder. I have accidentally lost those links.
> : Could somebody point me to them?
> :
> : Thank you,
> : --
> : Syed Zeeshan Haider
> :
> :
> :
> : --------------------------------------------------
> : http://szh.20m.com
> : http://gomusharrafgo.20m.com
> :
> :
>
| |
| Duane Bozarth 2004-05-30, 12:30 pm |
| Syed Zeeshan Haider wrote:
>
> I have some questions about the code given at
> http://vbnet.mvps.org/code/fileapi/countfiles.htm.
>
> Why are same declarations repeated in bas module and form module?
Don't know why, but since they're Public in the .bas module, they're not
needed in the Form...looks like it wasn't completely cleaned up to the
minimal required code to me...
> I haven't seen this kind of constant/variable declaration before:
> (Yes, I am learning VB on self-learning basis. ;-)
>
> Private Const FILE_ATTRIBUTE_ALL As Long = FILE_ATTRIBUTE_READONLY Or _
> FILE_ATTRIBUTE_HIDDEN Or _
> FILE_ATTRIBUTE_SYSTEM Or _
> FILE_ATTRIBUTE_ARCHIVE Or _
> FILE_ATTRIBUTE_NORMAL
>
> What is the "Or" operator for?
> What would be the "And" operator mean, if used?
In the Immediate Window try (for example, you can think of more...)
?FILE_ATTRIBUTE_READONLY
?FILE_ATTRIBUTE_HIDDEN
?FILE_ATTRIBUTE_READONLY Or FILE_ATTRIBUTE_HIDDEN
?FILE_ATTRIBUTE_READONLY And FILE_ATTRIBUTE_HIDDEN
To see all even more clearly, try Hex$() in conjunction w/above as
well...
Also, of course, type "Or" or "And" and press F1...
| |
| Randy Birch 2004-05-30, 12:30 pm |
| ah ... good catch. I've been slowly cleaning up code to move declares from
bas modules into forms to ease the creation of the demos. The bas code was a
leftover and can be completely deleted as all required elements are also
declared in the form. I've fixed that page ...thanks for letting me know.
As to the constants, while it would seem logical that you might want to view
hidden AND system AND normal files, in the vb world where these represent
different values that form a bit mask representing the sum of the attributes
of interest, you OR the values to reach the final mask value, rather than
AND them.
mask = FILE_ATTRIBUTE_HIDDEN Or FILE_ATTRIBUTE_DIRECTORY
AND is used to test if a particular bit mask is set.
if somefile'smask AND FILE_ATTRIBUTE_HIDDEN then
file has the FILE_ATTRIBUTE_HIDDEN bit set
end if
And XOR can remove (toggle) a bit mask ...
mask = FILE_ATTRIBUTE_HIDDEN Or FILE_ATTRIBUTE_DIRECTORY
Print mask
'<some time later>
If mask And FILE_ATTRIBUTE_HIDDEN Then
mask = mask Xor FILE_ATTRIBUTE_HIDDEN
Print mask
End If
So OR 'adds' it, XOR removes it, and AND checks for its presence.
--
Randy Birch
MVP Visual Basic
http://vbnet.mvps.org/
Please respond only to the newsgroups so all can benefit.
"Syed Zeeshan Haider" <szhatforumsNoVirusAndJunk@hotpop.com> wrote in
message news:Ov9UoVlREHA.2216@TK2MSFTNGP12.phx.gbl...
: I have some questions about the code given at
: http://vbnet.mvps.org/code/fileapi/countfiles.htm.
:
: Why are same declarations repeated in bas module and form module?
:
: I haven't seen this kind of constant/variable declaration before:
: (Yes, I am learning VB on self-learning basis. ;-)
:
: Private Const FILE_ATTRIBUTE_ALL As Long = FILE_ATTRIBUTE_READONLY Or _
: FILE_ATTRIBUTE_HIDDEN Or _
: FILE_ATTRIBUTE_SYSTEM Or _
: FILE_ATTRIBUTE_ARCHIVE Or _
: FILE_ATTRIBUTE_NORMAL
:
: What is the "Or" operator for?
: What would be the "And" operator mean, if used?
:
: Thank you,
: --
: Syed Zeeshan Haider
:
:
:
: --------------------------------------------------
: http://szh.20m.com
: http://gomusharrafgo.20m.com
:
:
: "Randy Birch" <rgb_removethis@mvps.org> wrote in message
: news:uTrYZhkREHA.2216@TK2MSFTNGP12.phx.gbl...
: > http://vbnet.mvps.org/code/fileapi/countfiles.htm
: >
: > --
: >
: > Randy Birch
: > MVP Visual Basic
: > http://vbnet.mvps.org/
: > Please respond only to the newsgroups so all can benefit.
: >
: >
: > "Syed Zeeshan Haider" <szhatforumsNoVirusAndJunk@hotpop.com> wrote in
: > message news:ePokAakREHA.2936@TK2MSFTNGP12.phx.gbl...
: > : Hello Experts,
: > : I have VB6EE on Win98SE.
: > :
: > : Once somebody pointed to some API and other code chunks on web for
: > counting
: > : files and sub-folders in a folder. I have accidentally lost those
links.
: > : Could somebody point me to them?
: > :
: > : Thank you,
: > : --
: > : Syed Zeeshan Haider
: > :
: > :
: > :
: > : --------------------------------------------------
: > : http://szh.20m.com
: > : http://gomusharrafgo.20m.com
: > :
: > :
: >
:
:
|
|
|
|
|