Amount of files on a drive?
Philip Swartzleonard
starx at pacbell.net
Tue Feb 5 23:57:54 EST 2002
G. Willoughby || Tue 05 Feb 2002 07:56:57a:
> i am using this at the minute:
> ------------------------------------------------------------------
> import win32api
> import string
> import os
>
> def countFiles(arg, dir, files):
> for file in files:
> count=count+1
>
> fileListings=[]
> driveList=string.split(win32api.GetLogicalDriveStrings(),'\0')[:-1]
>
> for drive in driveList:
> os.path.walk(drive, countFiles, 0)
> ------------------------------------------------------------------
> but its pretty slow any other suggestion how i could speed it up??
Well, first determine how long it actually takes (time it), and see how it
compares to say, selecting everything on the drive and hitting properties
in the context menu to get a count (i.e. see how good windows itself is at
it). It took my 800mhz athlon about 35 seconds to tell me that i have 6.15
gigs in 101,064 files in 3,930 folders on my C drive. Counting on that
scale can get slow.
--
Philip Sw "Starweaver" [rasx] :: www.rubydragon.com
More information about the Python-list
mailing list