Re: How many total files do I have on my system?
On 25 May, 19:22, "Pegasus \(MVP\)" <I....@fly.com.oz> wrote:
> <jameshanle...@yahoo.co.uk> wrote in message
>
> news:52da9206-b938-43d8-b437-3616647f9742@m3g2000hsc.googlegroups.com...
> On 25 May, 16:03, "Spin" <S...@invalid.com> wrote:
>
> > Gurus,
>
> > Is there a script I can run which counts the total number of files on my
> > computer including all operating system files? Looking for the bottom-line
> > number.
>
> > --
> > Spin
>
> This seems to work, do this from C:\>
>
> dir /a-d /b /s
>
> /a-d , Because dir normally gives files and directories. You want
> non-directories. /a gives all files hidden and system everything. /
> a-d gives /a but without directories. So includes hidden and system
>
> /b , just gives names.. be they of directories or files. But since
> you are only listing files, you will only get files
>
> /s , goes through subdirectories.
>
> (and since dos doesn't have a wc -l , a command to count lines) you
> then open it in Ms Word or Textpad or something and count look how
> many lines there are. Put cursor on last line and read the status bar.
>
> I just tested it with a small example I created from the command
> prompt with md and copy con.
> of directories \g\ and \g\f\
> with files of \g\a.txt and \g\f\b.txt
> And you can make a.txt hidden attrib +h a.txt
>
> C:\g>dir /a-d /b /s
> C:\g\a.txt
> C:\g\f\b.txt
>
> variations would be
> C:\g>dir /a /b /s (includes directories, though apparently not the
> current)
> C:\g\a.txt
> C:\g\f
> C:\g\f\b.txt
>
does your Outlook Express newsreader really not quote properly?
> ============
>
> Why not simplify your command
> dir /a-d /b /s
> to read
> dir c:\ /s
> so that it gives you the count of all files found?
>
You have a point about dir
In Win XP, it seems, DIR lists the total files and total directories.
I used DOS alot in the 6.22 days, and my memory was of DIR combining
its count of files and directories.. though i never relied on that so
I may be wrong.. But this link
http://www.tnd.com/camosun/elex130/dostutor1.html
suggests that memory was right..
I guess Win XP or NT updated the DIR command there.
Both begin / share the characteristic "Volume in drive C" , so it was
an easy google
http://www.tnd.com/camosun/elex130/dostutor1.html
(note- that MS-DOS_6.22 thing is just the label the author gave it, it
could be anything)
Volume in drive C is MS-DOS_6.22
Volume Serial Number is lE49-15E2
Directory of C:\
WINDOWS <DIR> 09-08-92 10:27p
TEMP <DIR> 05-15-92 12:09p
CONFIG SYS 278 09-23-92 10:50a
COMMAND COM 53014 09-18-92 6:00a
WINA20 386 9349 11-11-91 5:00a
DOS <DIR> 09-02-92 4:23p
AUTOEXEC BAT 290 09-23-92 10:54a
7 file(s) 62931 bytes
8732672 bytes free
Notice "7 file..."
so it combines files and directories in its count
Whereas on my computer running Win XP
C:\g>dir /s/a
Volume in drive C has no label.
Volume Serial Number is 60E8-0E4D
Directory of C:\g
25/05/2008 18:59 <DIR> .
25/05/2008 18:59 <DIR> ..
25/05/2008 18:59 5 a.txt
25/05/2008 18:59 <DIR> f
1 File(s) 5 bytes
Directory of C:\g\f
25/05/2008 18:59 <DIR> .
25/05/2008 18:59 <DIR> ..
25/05/2008 18:59 4 b.txt
1 File(s) 4 bytes
Total Files Listed:
2 File(s) 9 bytes
5 Dir(s) 6,213,378,048 bytes free
So it splits files and directories
It does count directories in a funny way, but files it counts
correctly.
which is fine for him
So
C:\>dir /s/a
will work fine for him.
> Note also that your command will not count hidden
> files. You would have to search for them separately,
> using the /h switch, or use the simple solution given
> by Dave Patrick:
> chkdsk c:
It does.
/a-d
does count hidden files.
AND system files and the rest. Just not directories.
As I explained.
dir /a-d is not like dir but "omit directories", it's like
dir /a , but omit directories.
It's your command dir /s or dir c:\ /s that does not count hidden
files.
But he can use /a instead of /a-d
and he an omit /b
There is no need to omit directories, since DIR gives a count at the
end, and the count - in win xp at least - splits files and
directories. The file count seems fine, and that's what he wants.
But I might do dir /s /a /b >abc
and open abc and check the last line number.. Just to check DIR
counted the files right. It does seem to count directories in a funny
way. I haven't fully tested DIR's counting method.
If you make an empty directory, Y, and do Y:\>dir /s
then it counts 2 directories, the parent(..) and the current(.)
The file count it gives is -probably- ok! It seems ok to me.