PC Review


Reply
Thread Tools Rate Thread

dir$ problem listing all files?

 
 
Fredrated
Guest
Posts: n/a
 
      22nd Jun 2009

using dir$ I don't seem to get all of the files in a director.

in the folowing loop, dir$ gives me 37,184 files, but windows explorer
directory properties says there are 37,315 files.
(These files are stored in one directory by a commercial application, I have
no control over this)

CODE:
strFile = Dir$(strDir)
rs.AddNew
rs!Filename = strFile
rs.Update

Do While True

strFile = Dir$()
If strFile = "" Then GoTo Done

rs.AddNew
rs!Filename = strFile
rs.Update

Loop

Done:
etc. etc.
ENDCODE

A (possibly related) problem is that windows explorer can't seem to list all
the files in name order, perhaps because there are too many to handle
properly?

For example, the following is a typical section of the directory list, in
name order:
2nd 15 E 4Th (13)1.jpg
02-Right fender1.JPG
3-18-03ACK1.doc
03 View of trees1.jpg
3KubicACK1.doc
03-Right door1.JPG

Any suggestion are welcome, since we are about to ditch this application. I
am in the process of trying to determine the completeness and accuracy of the
data, but things like the dir$ problem and the seemingly odd behavior of the
directory list are getting in the way.

Any suggestions greatly appreciated, thanks in advance for any help.

Fred


 
Reply With Quote
 
 
 
 
Jack Leach
Guest
Posts: n/a
 
      22nd Jun 2009

Two things to look at: first, I think you may be nearing the limit for the
number of files allowed in a folder. I'm not positive, but I think you're
close.

Also, have you checked for hidden/system files? The second argument of the
dir function lets you define the types... you may get different results by
playing around with this (and depending on your system settings for explorer).

hth
--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)



"Fredrated" wrote:

> using dir$ I don't seem to get all of the files in a director.
>
> in the folowing loop, dir$ gives me 37,184 files, but windows explorer
> directory properties says there are 37,315 files.
> (These files are stored in one directory by a commercial application, I have
> no control over this)
>
> CODE:
> strFile = Dir$(strDir)
> rs.AddNew
> rs!Filename = strFile
> rs.Update
>
> Do While True
>
> strFile = Dir$()
> If strFile = "" Then GoTo Done
>
> rs.AddNew
> rs!Filename = strFile
> rs.Update
>
> Loop
>
> Done:
> etc. etc.
> ENDCODE
>
> A (possibly related) problem is that windows explorer can't seem to list all
> the files in name order, perhaps because there are too many to handle
> properly?
>
> For example, the following is a typical section of the directory list, in
> name order:
> 2nd 15 E 4Th (13)1.jpg
> 02-Right fender1.JPG
> 3-18-03ACK1.doc
> 03 View of trees1.jpg
> 3KubicACK1.doc
> 03-Right door1.JPG
>
> Any suggestion are welcome, since we are about to ditch this application. I
> am in the process of trying to determine the completeness and accuracy of the
> data, but things like the dir$ problem and the seemingly odd behavior of the
> directory list are getting in the way.
>
> Any suggestions greatly appreciated, thanks in advance for any help.
>
> Fred
>
>

 
Reply With Quote
 
Fredrated
Guest
Posts: n/a
 
      22nd Jun 2009

'Show hidded files' is selected in win explorer, so I think it is a file
limit problem.
I am going to copy 10,000 files into another directory and see if I can then
get better results.

By the way, DOS says I have 37,200 files!

Thanks for your reply.

Fred


"Jack Leach" wrote:

> Two things to look at: first, I think you may be nearing the limit for the
> number of files allowed in a folder. I'm not positive, but I think you're
> close.
>
> Also, have you checked for hidden/system files? The second argument of the
> dir function lets you define the types... you may get different results by
> playing around with this (and depending on your system settings for explorer).
>
> hth
> --
> Jack Leach
> www.tristatemachine.com
>
> "I haven't failed, I've found ten thousand ways that don't work."
> -Thomas Edison (1847-1931)
>
>
>
> "Fredrated" wrote:
>
> > using dir$ I don't seem to get all of the files in a director.
> >
> > in the folowing loop, dir$ gives me 37,184 files, but windows explorer
> > directory properties says there are 37,315 files.
> > (These files are stored in one directory by a commercial application, I have
> > no control over this)
> >
> > CODE:
> > strFile = Dir$(strDir)
> > rs.AddNew
> > rs!Filename = strFile
> > rs.Update
> >
> > Do While True
> >
> > strFile = Dir$()
> > If strFile = "" Then GoTo Done
> >
> > rs.AddNew
> > rs!Filename = strFile
> > rs.Update
> >
> > Loop
> >
> > Done:
> > etc. etc.
> > ENDCODE
> >
> > A (possibly related) problem is that windows explorer can't seem to list all
> > the files in name order, perhaps because there are too many to handle
> > properly?
> >
> > For example, the following is a typical section of the directory list, in
> > name order:
> > 2nd 15 E 4Th (13)1.jpg
> > 02-Right fender1.JPG
> > 3-18-03ACK1.doc
> > 03 View of trees1.jpg
> > 3KubicACK1.doc
> > 03-Right door1.JPG
> >
> > Any suggestion are welcome, since we are about to ditch this application. I
> > am in the process of trying to determine the completeness and accuracy of the
> > data, but things like the dir$ problem and the seemingly odd behavior of the
> > directory list are getting in the way.
> >
> > Any suggestions greatly appreciated, thanks in advance for any help.
> >
> > Fred
> >
> >

 
Reply With Quote
 
Jack Leach
Guest
Posts: n/a
 
      22nd Jun 2009

> > > in the folowing loop, dir$ gives me 37,184 files, but windows explorer
> > > directory properties says there are 37,315 files.


> 'Show hidded files' is selected in win explorer, so I think it is a file
> limit problem.


I guess my point here was, if explorer is showing more files than Dir, and
you happen to be showing hidden/system files in explorer, there's a good
chance the Dir function is only returning the non-hidden files (as I believe
it's defaulted to do when no arguments are supplied).

I would try working with the Dir filetype arguments to see if you can show
the difference of 131 files being hidden or system. I would think that a
filelimit error would have more drastic effects than what you are seeing.

--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)



"Fredrated" wrote:

> 'Show hidded files' is selected in win explorer, so I think it is a file
> limit problem.
> I am going to copy 10,000 files into another directory and see if I can then
> get better results.
>
> By the way, DOS says I have 37,200 files!
>
> Thanks for your reply.
>
> Fred
>
>
> "Jack Leach" wrote:
>
> > Two things to look at: first, I think you may be nearing the limit for the
> > number of files allowed in a folder. I'm not positive, but I think you're
> > close.
> >
> > Also, have you checked for hidden/system files? The second argument of the
> > dir function lets you define the types... you may get different results by
> > playing around with this (and depending on your system settings for explorer).
> >
> > hth
> > --
> > Jack Leach
> > www.tristatemachine.com
> >
> > "I haven't failed, I've found ten thousand ways that don't work."
> > -Thomas Edison (1847-1931)
> >
> >
> >
> > "Fredrated" wrote:
> >
> > > using dir$ I don't seem to get all of the files in a director.
> > >
> > > in the folowing loop, dir$ gives me 37,184 files, but windows explorer
> > > directory properties says there are 37,315 files.
> > > (These files are stored in one directory by a commercial application, I have
> > > no control over this)
> > >
> > > CODE:
> > > strFile = Dir$(strDir)
> > > rs.AddNew
> > > rs!Filename = strFile
> > > rs.Update
> > >
> > > Do While True
> > >
> > > strFile = Dir$()
> > > If strFile = "" Then GoTo Done
> > >
> > > rs.AddNew
> > > rs!Filename = strFile
> > > rs.Update
> > >
> > > Loop
> > >
> > > Done:
> > > etc. etc.
> > > ENDCODE
> > >
> > > A (possibly related) problem is that windows explorer can't seem to list all
> > > the files in name order, perhaps because there are too many to handle
> > > properly?
> > >
> > > For example, the following is a typical section of the directory list, in
> > > name order:
> > > 2nd 15 E 4Th (13)1.jpg
> > > 02-Right fender1.JPG
> > > 3-18-03ACK1.doc
> > > 03 View of trees1.jpg
> > > 3KubicACK1.doc
> > > 03-Right door1.JPG
> > >
> > > Any suggestion are welcome, since we are about to ditch this application. I
> > > am in the process of trying to determine the completeness and accuracy of the
> > > data, but things like the dir$ problem and the seemingly odd behavior of the
> > > directory list are getting in the way.
> > >
> > > Any suggestions greatly appreciated, thanks in advance for any help.
> > >
> > > Fred
> > >
> > >

 
Reply With Quote
 
Fredrated
Guest
Posts: n/a
 
      22nd Jun 2009

Sorry, I should have been a little more compete in my answer.

I am using "I:\Dorn\DOCS\*.*" as the initial DIR$ argument.
Are there other arguments that can be used with Dir$?

Thanks

Fred


Is there
"Jack Leach" wrote:

> > > > in the folowing loop, dir$ gives me 37,184 files, but windows explorer
> > > > directory properties says there are 37,315 files.

>
> > 'Show hidded files' is selected in win explorer, so I think it is a file
> > limit problem.

>
> I guess my point here was, if explorer is showing more files than Dir, and
> you happen to be showing hidden/system files in explorer, there's a good
> chance the Dir function is only returning the non-hidden files (as I believe
> it's defaulted to do when no arguments are supplied).
>
> I would try working with the Dir filetype arguments to see if you can show
> the difference of 131 files being hidden or system. I would think that a
> filelimit error would have more drastic effects than what you are seeing.
>
> --
> Jack Leach
> www.tristatemachine.com
>
> "I haven't failed, I've found ten thousand ways that don't work."
> -Thomas Edison (1847-1931)
>
>
>
> "Fredrated" wrote:
>
> > 'Show hidded files' is selected in win explorer, so I think it is a file
> > limit problem.
> > I am going to copy 10,000 files into another directory and see if I can then
> > get better results.
> >
> > By the way, DOS says I have 37,200 files!
> >
> > Thanks for your reply.
> >
> > Fred
> >
> >
> > "Jack Leach" wrote:
> >
> > > Two things to look at: first, I think you may be nearing the limit for the
> > > number of files allowed in a folder. I'm not positive, but I think you're
> > > close.
> > >
> > > Also, have you checked for hidden/system files? The second argument of the
> > > dir function lets you define the types... you may get different results by
> > > playing around with this (and depending on your system settings for explorer).
> > >
> > > hth
> > > --
> > > Jack Leach
> > > www.tristatemachine.com
> > >
> > > "I haven't failed, I've found ten thousand ways that don't work."
> > > -Thomas Edison (1847-1931)
> > >
> > >
> > >
> > > "Fredrated" wrote:
> > >
> > > > using dir$ I don't seem to get all of the files in a director.
> > > >
> > > > in the folowing loop, dir$ gives me 37,184 files, but windows explorer
> > > > directory properties says there are 37,315 files.
> > > > (These files are stored in one directory by a commercial application, I have
> > > > no control over this)
> > > >
> > > > CODE:
> > > > strFile = Dir$(strDir)
> > > > rs.AddNew
> > > > rs!Filename = strFile
> > > > rs.Update
> > > >
> > > > Do While True
> > > >
> > > > strFile = Dir$()
> > > > If strFile = "" Then GoTo Done
> > > >
> > > > rs.AddNew
> > > > rs!Filename = strFile
> > > > rs.Update
> > > >
> > > > Loop
> > > >
> > > > Done:
> > > > etc. etc.
> > > > ENDCODE
> > > >
> > > > A (possibly related) problem is that windows explorer can't seem to list all
> > > > the files in name order, perhaps because there are too many to handle
> > > > properly?
> > > >
> > > > For example, the following is a typical section of the directory list, in
> > > > name order:
> > > > 2nd 15 E 4Th (13)1.jpg
> > > > 02-Right fender1.JPG
> > > > 3-18-03ACK1.doc
> > > > 03 View of trees1.jpg
> > > > 3KubicACK1.doc
> > > > 03-Right door1.JPG
> > > >
> > > > Any suggestion are welcome, since we are about to ditch this application. I
> > > > am in the process of trying to determine the completeness and accuracy of the
> > > > data, but things like the dir$ problem and the seemingly odd behavior of the
> > > > directory list are getting in the way.
> > > >
> > > > Any suggestions greatly appreciated, thanks in advance for any help.
> > > >
> > > > Fred
> > > >
> > > >

 
Reply With Quote
 
Dirk Goldgar
Guest
Posts: n/a
 
      22nd Jun 2009

"Fredrated" <(E-Mail Removed)> wrote in message
news:F8DFFAC8-8A4E-427F-868C-(E-Mail Removed)...
> Sorry, I should have been a little more compete in my answer.
>
> I am using "I:\Dorn\DOCS\*.*" as the initial DIR$ argument.
> Are there other arguments that can be used with Dir$?



Have you considered looking it up in the online help?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

 
Reply With Quote
 
Jack Leach
Guest
Posts: n/a
 
      22nd Jun 2009

From the help file (type Dir and hit F1), it gives all arguments and their
descriptions.

Dir(pathname[, attributes])]

Pathname you already have, the attributes argument is the optional second,
which has to be an integer that is the sum of any of the given constants
(they do this so you can use more than one constant here). The windows file
attributes are as follows:

vbNormal = 0
vbReadOnly = 1
vbHidden = 2
vbSystem = 4
vbVolume = 8
vbDirectory = 16

So therefore, you can show Normal, Hidden, Readonly and System files all at
once by supplying the second argument as 7 (0+1+2+4)

Dir("C:\YourPath\", 7)

or

Dir("C:\YourPath\", vbNormal + vbReadOnly + vbHidden + vbSystem)

the help file is a highly underrated tool, and every keyword can be pulled
up by pressing F1 with the cursor on the right side of the word from within
the vba ide.

--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)



"Fredrated" wrote:

> Sorry, I should have been a little more compete in my answer.
>
> I am using "I:\Dorn\DOCS\*.*" as the initial DIR$ argument.
> Are there other arguments that can be used with Dir$?
>
> Thanks
>
> Fred
>
>
> Is there
> "Jack Leach" wrote:
>
> > > > > in the folowing loop, dir$ gives me 37,184 files, but windows explorer
> > > > > directory properties says there are 37,315 files.

> >
> > > 'Show hidded files' is selected in win explorer, so I think it is a file
> > > limit problem.

> >
> > I guess my point here was, if explorer is showing more files than Dir, and
> > you happen to be showing hidden/system files in explorer, there's a good
> > chance the Dir function is only returning the non-hidden files (as I believe
> > it's defaulted to do when no arguments are supplied).
> >
> > I would try working with the Dir filetype arguments to see if you can show
> > the difference of 131 files being hidden or system. I would think that a
> > filelimit error would have more drastic effects than what you are seeing.
> >
> > --
> > Jack Leach
> > www.tristatemachine.com
> >
> > "I haven't failed, I've found ten thousand ways that don't work."
> > -Thomas Edison (1847-1931)
> >
> >
> >
> > "Fredrated" wrote:
> >
> > > 'Show hidded files' is selected in win explorer, so I think it is a file
> > > limit problem.
> > > I am going to copy 10,000 files into another directory and see if I can then
> > > get better results.
> > >
> > > By the way, DOS says I have 37,200 files!
> > >
> > > Thanks for your reply.
> > >
> > > Fred
> > >
> > >
> > > "Jack Leach" wrote:
> > >
> > > > Two things to look at: first, I think you may be nearing the limit for the
> > > > number of files allowed in a folder. I'm not positive, but I think you're
> > > > close.
> > > >
> > > > Also, have you checked for hidden/system files? The second argument of the
> > > > dir function lets you define the types... you may get different results by
> > > > playing around with this (and depending on your system settings for explorer).
> > > >
> > > > hth
> > > > --
> > > > Jack Leach
> > > > www.tristatemachine.com
> > > >
> > > > "I haven't failed, I've found ten thousand ways that don't work."
> > > > -Thomas Edison (1847-1931)
> > > >
> > > >
> > > >
> > > > "Fredrated" wrote:
> > > >
> > > > > using dir$ I don't seem to get all of the files in a director.
> > > > >
> > > > > in the folowing loop, dir$ gives me 37,184 files, but windows explorer
> > > > > directory properties says there are 37,315 files.
> > > > > (These files are stored in one directory by a commercial application, I have
> > > > > no control over this)
> > > > >
> > > > > CODE:
> > > > > strFile = Dir$(strDir)
> > > > > rs.AddNew
> > > > > rs!Filename = strFile
> > > > > rs.Update
> > > > >
> > > > > Do While True
> > > > >
> > > > > strFile = Dir$()
> > > > > If strFile = "" Then GoTo Done
> > > > >
> > > > > rs.AddNew
> > > > > rs!Filename = strFile
> > > > > rs.Update
> > > > >
> > > > > Loop
> > > > >
> > > > > Done:
> > > > > etc. etc.
> > > > > ENDCODE
> > > > >
> > > > > A (possibly related) problem is that windows explorer can't seem to list all
> > > > > the files in name order, perhaps because there are too many to handle
> > > > > properly?
> > > > >
> > > > > For example, the following is a typical section of the directory list, in
> > > > > name order:
> > > > > 2nd 15 E 4Th (13)1.jpg
> > > > > 02-Right fender1.JPG
> > > > > 3-18-03ACK1.doc
> > > > > 03 View of trees1.jpg
> > > > > 3KubicACK1.doc
> > > > > 03-Right door1.JPG
> > > > >
> > > > > Any suggestion are welcome, since we are about to ditch this application. I
> > > > > am in the process of trying to determine the completeness and accuracy of the
> > > > > data, but things like the dir$ problem and the seemingly odd behavior of the
> > > > > directory list are getting in the way.
> > > > >
> > > > > Any suggestions greatly appreciated, thanks in advance for any help.
> > > > >
> > > > > Fred
> > > > >
> > > > >

 
Reply With Quote
 
Fredrated
Guest
Posts: n/a
 
      22nd Jun 2009

Thanks, I searched for arguments, only to confue the issue more.
no arguments returns files with no attributes, my original attempt.
adding vbHidden is supposed to add hidden files to the files with no
attributes.

However, adding vbHidden now returns even fewer files!

I am going to try another approach.
I will take the table of files referenced by the application and loop
through it, asking for each file if it exists in the directory with
If Len(Dir(Path & filename)) > 0 Then .... file exists in directory

If this works it should be good enough.

Thanks again.

Fred

"Dirk Goldgar" wrote:

> "Fredrated" <(E-Mail Removed)> wrote in message
> news:F8DFFAC8-8A4E-427F-868C-(E-Mail Removed)...
> > Sorry, I should have been a little more compete in my answer.
> >
> > I am using "I:\Dorn\DOCS\*.*" as the initial DIR$ argument.
> > Are there other arguments that can be used with Dir$?

>
>
> Have you considered looking it up in the online help?
>
> --
> Dirk Goldgar, MS Access MVP
> www.datagnostics.com
>
> (please reply to the newsgroup)
>

 
Reply With Quote
 
Dirk Goldgar
Guest
Posts: n/a
 
      22nd Jun 2009

"Fredrated" <(E-Mail Removed)> wrote in message
news:23647BB7-CC29-4B28-ABDB-(E-Mail Removed)...
> Thanks, I searched for arguments, only to confue the issue more.
> no arguments returns files with no attributes, my original attempt.
> adding vbHidden is supposed to add hidden files to the files with no
> attributes.
>
> However, adding vbHidden now returns even fewer files!



I think you're doing something wrong in your code. However, there is one
wrinkle to using Dir(). In the midst of a Dir() loop, other calls to
Dir() -- other than the initial one and the one at the bottom of the loop to
get the next file -- will reset the search. That can confuse matters.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Get a listing of files with WMI CSharpWorker Microsoft C# .NET 4 7th Mar 2010 10:58 PM
DVD/CD not listing files =?Utf-8?B?RGF2ZQ==?= Windows Vista General Discussion 1 1st Nov 2007 10:29 AM
FTP Listing Files Problem =?Utf-8?B?bTAwbm0wbmtleQ==?= Microsoft Dot NET Framework 2 9th May 2006 09:16 AM
listing files on a CD windsurferLA Windows XP General 3 17th Dec 2005 06:49 PM
Son of Spy New Files Listing Pauline Johnson Freeware 0 10th May 2004 02:41 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:14 PM.