Part of the Samples Website. 8/16/97.

samples.basicStuff.largestFiles

«Find the 10 largest files on the system disk
local (diskName = file.getSystemDisk ())
local (count = 10)
local (largeList = {}) «start with the empty list
local (sizeSmallestInList = infinity, ixSmallestInList)
local (f)
fileloop (f in diskName, infinity)
local (sizeThisFile = file.size (f))
local (name = file.fileFromPath (f))
if sizeOf (largeList) < count
msg (name)
largeList = largeList + f
if sizeThisFile < sizeSmallestInList
sizeSmallestInList = sizeThisFile
ixSmallestInList = sizeOf (largeList)
else
if sizeThisFile > sizeSmallestInList
local (i)
msg (name)
largeList [ixSmallestInList] = f
sizeSmallestInList = infinity
for i = 1 to count
local (size = file.size (largeList [i]))
if size < sizeSmallestInList
sizeSmallestInList = size
ixSmallestInList = i
rollBeachBall ()
scratchpad.largeList = largeList «save in database


This page was last built on Sat, Aug 16, 1997 at 6:37:36 PM. You can download the current set of sample scripts from our FTP site. Dave