use sendmessage to find folders and files in the folders in vb6 
Author Message
 use sendmessage to find folders and files in the folders in vb6

Hello

I am trying to quickly show the txt-files which are located in for
example 320 subfolders of a folder and read the content of those files
in a listview of a form. I can't find a QUICK way to do this. Should I
use Sendmessage to do this? And if Yes ,how should I do this?
Thanks
Charles van der Werf



Wed, 08 Aug 2012 05:05:02 GMT  
 use sendmessage to find folders and files in the folders in vb6


Quote:
> Hello

> I am trying to quickly show the txt-files which are located in for
> example 320 subfolders of a folder and read the content of those files
> in a listview of a form. I can't find a QUICK way to do this. Should I
> use Sendmessage to do this? And if Yes ,how should I do this?

So you're searching for txt files in 320 folders?  And then reading those
files and loading their contents into a listview? And what would your idea
be (time-wise) of doing this quickly? There are many factors involved.  Do
any of those 320 subfolders have their own subfolders that you're also
searching?  Approximately how many txt files?  Are you loading the entire
contents of ALL txt files into the ListView (and why a ListView)? That could
take anywhere from a couple of minutes to perhaps several hours. It all
depends, not only on just the couple things I mentioned but also the
computer and its hardware.

Probably your best option to find the files is to use the FindFirstFile,
FindNextFile, and FindClose API functions. Search the newsgroup for
FindFirstFile and you'll find plenty of example code to use these functions
in a recursive procedure (recursion is what makes it possible to specify one
folder and search all its subfolders).

For reading each file's contents, I'd think VB's own file I/O should be
fine.

You're also probably going to find that this will slow down exponentially as
you add more and more ListItems into the ListView. Which is why I question
using a ListView for this.

--
Mike



Wed, 08 Aug 2012 06:45:26 GMT  
 use sendmessage to find folders and files in the folders in vb6

Quote:


> > Hello

> > I am trying to quickly show the txt-files which are located in for
> > example 320 subfolders of a folder and read the content of those files
> > in a listview of a form. I can't find a QUICK way to do this. Should I
> > use Sendmessage to do this? And if Yes ,how should I do this?

> So you're searching for txt files in 320 folders? ?And then reading those
> files and loading their contents into a listview? And what would your idea
> be (time-wise) of doing this quickly? There are many factors involved. ?Do
> any of those 320 subfolders have their own subfolders that you're also
> searching? ?Approximately how many txt files? ?Are you loading the entire
> contents of ALL txt files into the ListView (and why a ListView)? That could
> take anywhere from a couple of minutes to perhaps several hours. It all
> depends, not only on just the couple things I mentioned but also the
> computer and its hardware.

> Probably your best option to find the files is to use the FindFirstFile,
> FindNextFile, and FindClose API functions. Search the newsgroup for
> FindFirstFile and you'll find plenty of example code to use these functions
> in a recursive procedure (recursion is what makes it possible to specify one
> folder and search all its subfolders).

> For reading each file's contents, I'd think VB's own file I/O should be
> fine.

> You're also probably going to find that this will slow down exponentially as
> you add more and more ListItems into the ListView. Which is why I question
> using a ListView for this.

> --
> Mike

At this moment, it takes appr, 7 seconds, but is should be 1 second.
Every subfolder contrains one textfile and the information of that
textfile is put on a listview. Should I use a MSFlexgrid, is that
quicker? The reading is done about a hunderd times by bookkeepers,
thats why it should be quick.>
Thanks
Catharainus


Wed, 08 Aug 2012 06:59:21 GMT  
 use sendmessage to find folders and files in the folders in vb6

Quote:

> At this moment, it takes appr, 7 seconds, but is should be 1 second.
> Every subfolder contrains one textfile and the information of that
> textfile is put on a listview. Should I use a MSFlexgrid, is that
> quicker? The reading is done about a hunderd times by bookkeepers,
> thats why it should be quick.>

Break the problem down, to find the bottleneck.  For example, if you
comment out the part that adds the text to the listview, is it fast
enough?  (Betting yes, common controls tend to be slugs!)

--
.NET: It's About Trust!
http://vfred.mvps.org



Wed, 08 Aug 2012 07:20:49 GMT  
 use sendmessage to find folders and files in the folders in vb6


Quote:

> At this moment, it takes appr, 7 seconds, but is should be 1 second.
> Every subfolder contrains one textfile and the information of that
> textfile is put on a listview. Should I use a MSFlexgrid, is that
> quicker? The reading is done about a hunderd times by bookkeepers,
> thats why it should be quick.>

So your complaint is that it takes 7 seconds to search 320 subfolders for
.txt files and display the contents of those files in a ListView?  What make
you think it should only take 1 second? IMO, 7 seconds is not that bad. As I
said, I could see it taking minutes to hours, depending on number of files,
size of those files, etc., etc. Maybe these bookkeepers just need faster
computers, or faster hard drives, or maybe they just need to defrag their
hard drives.

If you're not using FindFirstFile and FindNextFile, you might try them.
They might make things a little faster (just kind of making an assumption
since you didn't state HOW you're currently searching these 320 folders for
these .txt files). I can't tell you whether it'd actually be worth the time
and effort. The only way to know is to try and see if the results are
better.

--
Mike



Wed, 08 Aug 2012 07:24:52 GMT  
 use sendmessage to find folders and files in the folders in vb6



Quote:



>> Hello

>> I am trying to quickly show the txt-files which are located in for
>> example 320 subfolders of a folder and read the content of those files
>> in a listview of a form. I can't find a QUICK way to do this. Should I
>> use Sendmessage to do this? And if Yes ,how should I do this?

> So you're searching for txt files in 320 folders?  And then reading those
> files and loading their contents into a listview? And what would your idea be
> (time-wise) of doing this quickly? There are many factors involved.  Do any of
> those 320 subfolders have their own subfolders that you're also searching?
> Approximately how many txt files?  Are you loading the entire contents of ALL
> txt files into the ListView (and why a ListView)? That could take anywhere
> from a couple of minutes to perhaps several hours. It all depends, not only on
> just the couple things I mentioned but also the computer and its hardware.

> Probably your best option to find the files is to use the FindFirstFile,
> FindNextFile, and FindClose API functions. Search the newsgroup for
> FindFirstFile and you'll find plenty of example code to use these functions in
> a recursive procedure (recursion is what makes it possible to specify one
> folder and search all its subfolders).

> For reading each file's contents, I'd think VB's own file I/O should be fine.

> You're also probably going to find that this will slow down exponentially as
> you add more and more ListItems into the ListView. Which is why I question
> using a ListView for this.

> --
> Mike

To add to this: even one folder with many text files - even small ones -
will slow down the OS in accessing its directory. One of my customers
knits medical stockings - made to measure - and got the orders as plain
text files transfered via RAS into a shared directory. Our programs
processed the data and moved the files to an archive directory.
Small files of 400 to 800 bytes, but 300 to more than 400 per day.
We found that storing more than 20,000 files (3 months) in one directory
was a bad idea, the system slowed down to a crawl when accessing
these directories.

Helmut.



Wed, 08 Aug 2012 07:26:59 GMT  
 use sendmessage to find folders and files in the folders in vb6


Quote:
> To add to this: even one folder with many text files - even small ones -
> will slow down the OS in accessing its directory. One of my customers
> knits medical stockings - made to measure - and got the orders as plain
> text files transfered via RAS into a shared directory. Our programs
> processed the data and moved the files to an archive directory.
> Small files of 400 to 800 bytes, but 300 to more than 400 per day.
> We found that storing more than 20,000 files (3 months) in one directory
> was a bad idea, the system slowed down to a crawl when accessing
> these directories.

Good comment and definitely something to be aware of, but in this case we
can rule that out per a later post with a little more information.

--
Mike



Wed, 08 Aug 2012 07:39:04 GMT  
 use sendmessage to find folders and files in the folders in vb6

Quote:

> So your complaint is that it takes 7 seconds to search 320 subfolders for
> .txt files and display the contents of those files in a ListView?  What make
> you think it should only take 1 second? IMO, 7 seconds is not that bad. As I
> said, I could see it taking minutes to hours, depending on number of files,
> size of those files, etc., etc. Maybe these bookkeepers just need faster
> computers, or faster hard drives, or maybe they just need to defrag their
> hard drives.

Or maybe they just need an IT dept, or even a dept guru, with a clue.  
320 folders, *each* with a single TXT file???  That's pretty funny.

--
.NET: It's About Trust!
http://vfred.mvps.org



Wed, 08 Aug 2012 07:42:18 GMT  
 use sendmessage to find folders and files in the folders in vb6

Quote:

> > So your complaint is that it takes 7 seconds to search 320 subfolders for
> > .txt files and display the contents of those files in a ListView? ?What make
> > you think it should only take 1 second? IMO, 7 seconds is not that bad. As I
> > said, I could see it taking minutes to hours, depending on number of files,
> > size of those files, etc., etc. Maybe these bookkeepers just need faster
> > computers, or faster hard drives, or maybe they just need to defrag their
> > hard drives.

> Or maybe they just need an IT dept, or even a dept guru, with a clue. ?
> 320 folders, *each* with a single TXT file??? ?That's pretty funny.

> --
> .NET: It's About Trust!http://vfred.mvps.org

Thanks my friends
As have read this with a smile on my face as you probarbly can
understand. I will reconsider the options, for example the firstfile
nextfile option Thanks
Cath


Wed, 08 Aug 2012 08:36:55 GMT  
 use sendmessage to find folders and files in the folders in vb6

Quote:



>>> So your complaint is that it takes 7 seconds to search 320 subfolders for
>>> .txt files and display the contents of those files in a ListView? ?What
>>> make you think it should only take 1 second? IMO, 7 seconds is not that
>>> bad. As I said, I could see it taking minutes to hours, depending on number
>>> of files, size of those files, etc., etc. Maybe these bookkeepers just need
>>> faster computers, or faster hard drives, or maybe they just need to defrag
>>> their hard drives.

>> Or maybe they just need an IT dept, or even a dept guru, with a clue. ?
>> 320 folders, *each* with a single TXT file??? ?That's pretty funny.

> Thanks my friends
> As have read this with a smile on my face as you probarbly can
> understand. I will reconsider the options, for example the firstfile
> nextfile option Thanks

Happy to see it was taken in the same spirit offered.  :-)

--
.NET: It's About Trust!
http://vfred.mvps.org



Wed, 08 Aug 2012 08:43:36 GMT  
 use sendmessage to find folders and files in the folders in vb6


| Or maybe they just need an IT dept, or even a dept guru, with a clue.
| 320 folders, *each* with a single TXT file???  That's pretty funny.

320 subfolders.  That's just plain sad.

Why?



Wed, 08 Aug 2012 09:47:01 GMT  
 use sendmessage to find folders and files in the folders in vb6


Quote:


> | Or maybe they just need an IT dept, or even a dept guru, with a clue.
> | 320 folders, *each* with a single TXT file???  That's pretty funny.

> 320 subfolders.  That's just plain sad.

> Why?

My guess is that they receive these files from different clients, and using
subfolders prevents file name conflicts. Obviously there are many better
ways than this.


Wed, 08 Aug 2012 10:20:17 GMT  
 use sendmessage to find folders and files in the folders in vb6


Quote:





>> ...
>>> Hello

>>> I am trying to quickly show the txt-files which are located in for
>>> example 320 subfolders of a folder and read the content of those
>>> files in a listview of a form. I can't find a QUICK way to do this.
>>> Should I use Sendmessage to do this? And if Yes ,how should I do
>>> this?

>> So you're searching for txt files in 320 folders?  And then reading
>> those files and loading their contents into a listview? And what
>> would your idea be (time-wise) of doing this quickly? There are many
>> factors involved.  Do any of those 320 subfolders have their own
>> subfolders that you're also searching? Approximately how many txt
>> files?  Are you loading the entire contents of ALL txt files into the
>> ListView (and why a ListView)? That could take anywhere from a couple
>> of minutes to perhaps several hours. It all depends, not only on just
>> the couple things I mentioned but also the computer and its hardware.

>> Probably your best option to find the files is to use the
>> FindFirstFile, FindNextFile, and FindClose API functions. Search the
>> newsgroup for FindFirstFile and you'll find plenty of example code to
>> use these functions in a recursive procedure (recursion is what makes
>> it possible to specify one folder and search all its subfolders).

>> For reading each file's contents, I'd think VB's own file I/O should
>> be fine.

>> You're also probably going to find that this will slow down
>> exponentially as you add more and more ListItems into the ListView.
>> Which is why I question using a ListView for this.

>> --
>> Mike

> To add to this: even one folder with many text files - even small ones
> - will slow down the OS in accessing its directory. One of my
> customers knits medical stockings - made to measure - and got the
> orders as plain text files transfered via RAS into a shared directory.
> Our programs processed the data and moved the files to an archive
> directory. Small files of 400 to 800 bytes, but 300 to more than 400
> per day. We found that storing more than 20,000 files (3 months) in
> one directory was a bad idea, the system slowed down to a crawl when
> accessing these directories.

Was this a system with a realtime AV scanner running on it ?

I had this downloaded demo program that was a single self-extrafting exe
file of 450 megs. Every time I went to access the folder, Explorer
appeared to hang and wouldn't do anything and several times I killed it
and restarted Explorer......

......As it turns out, I was just being impatient and not waiting long
enough for the AV scanner to finish it's job. (Although, we *shouldn't*
all *need* to use AV scanners anyway.......maybe that's one of the
reason's my Linux box seems a bit snappier.)



Wed, 08 Aug 2012 22:30:42 GMT  
 use sendmessage to find folders and files in the folders in vb6

Quote:
> I had this downloaded demo program that was a single self-extrafting exe
> file of 450 megs. Every time I went to access the folder, Explorer
> appeared to hang and wouldn't do anything and several times I killed it
> and restarted Explorer......

> ......As it turns out, I was just being impatient and not waiting long
> enough for the AV scanner to finish it's job. (Although, we *shouldn't*
> all *need* to use AV scanners anyway.......maybe that's one of the
> reason's my Linux box seems a bit snappier.)

Off topic: It's not your AV software but Explorer in XP+SP2+ scans the file
looking for digital signatures. This was reported many times on Inno Setup
groups with people who make large installers. Examples:

Large signed installers and Vista
http://news.jrsoftware.org/news/innosetup/msg83093.html

UAC on Vista takes a very long time to respond on large files
http://news.jrsoftware.org/news/innosetup/msg77894.html



Thu, 09 Aug 2012 01:19:16 GMT  
 
 [ 14 post ] 

 Relevant Pages 

1. Build XML of folders, sub folders and files from specified folder

2. How to delete folders/files within a folder but not the folder itself

3. Using Commondialog (VB6 Ent) to select a folder - NOT a file

4. create a folder or find default temp folder

5. Find Sub Folder Name within a Folder

6. Windows Find (Start:Find:Files and Folders)

7. folder in a folder in a folder...

8. Determining if a folder is a local pst folder or a imap (server folder)

9. Folder extension or using CommonDialogs to return folders...

10. Using folder object when the user doesn't have access to the folder

11. Accessing a folder in public folders using an ADO recordset

12. instead of using browse for folder, how can u put those virtual folder into a co

 

 
Powered by phpBB® Forum Software