Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADIR command to return File Sizes 2

Status
Not open for further replies.

martin250

Programmer
Feb 26, 2002
11
GB
Hi, I need some help returning the total size of three file types in a specific folder...I've been using ADIR but can't seem to get it to work, I hope this is the correct way...basically I'm after the total size of all *.dbf *.cdx *.fpt files in a folder called c:\data

Thanks in Advance

Martin
 
Hi, try something like this:

set default to c:\data
? filesize("*.dbf")
? filesize("*.cdx")
? filesize("*.ftp")

function filesize
parameter skeleton
store 0 to totbytes
dimension yourarray(1,5)
yourarray(1,1) = "*empty*"
= adir(yourarray, skeleton)
if yourarray(1,1) = "*empty*"
return(0)
else
for i=1 to alen(yourarray, 1)
totbytes = totbytes + yourarray(i,2)
endfor
endif
return(totbytes)
 
You might also try this in the Command Window:

DIMENSION dir_arr (1)
=ADIR(dir_arr, "C:\*.*")
CLEAR
DISPLAY MEMORY LIKE dir_arr*

You should see the file size in the 2nd "column" of the array. Example: fsize = dir_arr(i,2)

Good Luck,


JRB-Bldr
VisionQuest Consulting
Business Analyst & CIO Consulting Services
CIOServices@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top