Re: Size of a folder?
This WebDNA talk-list message is from 2003
It keeps the original formatting.
numero = 52465
interpreted = N
texte = Here's an example using a recursive WebDNA 5 function that I posted a little while back...---begin code---[function name=FolderSize][math show=F]totSize=0[/math][listfiles path=[url][theFolder][/url]][if [isfile]=T][then][math show=F]totSize=totSize+[size][/math][/then][else][math show=F]totSize=totSize+[FolderSize thefolder=[url][theFolder][filename][/url]][/math][/else][/if][/listfiles][return][totSize][/return][/function][text]myFolder=/[/text][!]Change this to any folder path, but make sure to leave a trailing slash[/!][FolderSize theFolder=[url][myFolder][/url]] total bytes in [myFolder]---end code---- brianOn Friday, August 22, 2003, at 05:52 PM, WebDna @ wrote:> Damn ... giving away all my sevrets! :)>> This is how I do it, but if there is a better way, by all means > someone tell> me.>>> [math show=f]totaldiskspace=0[/math]> [math show=f]diskspace=0[/math]> [text]dir=../[/text]>> -- create an include file called "totalspace.inc". It will call itself > in a> loop to crawl the folders. Add the below into the include.>> [ListFiles path=[dir]]> [if ("[filename]"^".tpl") | ("[filename]"^".db") |> ("[filename]"^"motoadmin")]> [else]> [math show=f]totaldiskspace=ceil([size]/1024)+[totaldiskspace][/math]> [if ("[IsFolder]" = "T")]> [then][include file=totalspace.inc&dir=[dir][filename]/][/then]> [/if]>> [/else]> [/if]> [/ListFiles]>> Note I hide any files that are webcat related as this is used in a file> manager system for a server and do not want people editing the file > manager.> So we hide those files. Also no one is using webcat files but us.>>>>>> ----- Original Message -----> From:
> To: "WebDNA Talk" > Sent: Friday, August 22, 2003 5:12 PM> Subject: Size of a folder?>>>> Anyway to have WebDNA figure out the size of a folder and the >> contents in> it?>>>> Jeff>-- Brian Fries, BrainScan Software -- http://www.brainscansoftware.com ---------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/
Associated Messages, from the most recent to the oldest:
Here's an example using a recursive WebDNA 5 function that I posted a little while back...---begin code---[function name=FolderSize][math show=F]totSize=0[/math][listfiles path=[url][theFolder][/url]][if [isfile]=T][then][math show=F]totSize=totSize+[size][/math][/then][else][math show=F]totSize=totSize+[FolderSize thefolder=[url][theFolder][filename][/url]][/math][/else][/if][/listfiles][return][totSize][/return][/function][text]myFolder=/[/text][!]Change this to any folder path, but make sure to leave a trailing slash[/!][FolderSize theFolder=[url][myFolder][/url]] total bytes in [myFolder]---end code---- brianOn Friday, August 22, 2003, at 05:52 PM, WebDna @ wrote:> Damn ... giving away all my sevrets! :)>> This is how I do it, but if there is a better way, by all means > someone tell> me.>>> [math show=f]totaldiskspace=0[/math]> [math show=f]diskspace=0[/math]> [text]dir=../[/text]>> -- create an include file called "totalspace.inc". It will call itself > in a> loop to crawl the folders. Add the below into the include.>> [ListFiles path=[dir]]> [if ("[filename]"^".tpl") | ("[filename]"^".db") |> ("[filename]"^"motoadmin")]> [else]> [math show=f]totaldiskspace=ceil([size]/1024)+[totaldiskspace][/math]> [if ("[IsFolder]" = "T")]> [then][include file=totalspace.inc&dir=[dir][filename]/][/then]> [/if]>> [/else]> [/if]> [/ListFiles]>> Note I hide any files that are webcat related as this is used in a file> manager system for a server and do not want people editing the file > manager.> So we hide those files. Also no one is using webcat files but us.>>>>>> ----- Original Message -----> From: > To: "WebDNA Talk" > Sent: Friday, August 22, 2003 5:12 PM> Subject: Size of a folder?>>>> Anyway to have WebDNA figure out the size of a folder and the >> contents in> it?>>>> Jeff>-- Brian Fries, BrainScan Software -- http://www.brainscansoftware.com ---------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/
Brian Fries
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
Multiple catalog databases and showcart (1997)
with Link i need to (1997)
Using Plug-In while running 1.6.1 (1997)
About Include (2001)
Clear command and ShoppingCart.tmpl (1997)
buy 2 items get this free (2003)
Triggers (2003)
Trouble creating a temp database (2000)
WC2b15 - [HTMLx]...[/HTMLx] problems (1997)
Moving a record from one dataabse to another. (2000)
Searching Relational Databases (2004)
date pref (1999)
Robert Minor duplicate mail (1997)
WebCat2b13MacPlugIn - [showif][search][/showif] (1997)
2.0Beta Command Ref (can't find this instruction) (1997)
a search based on ^(contains) (1998)
WebCat2 several catalogs? (1997)
Searching multiple Databases (1997)
searchable list archive (1997)
RE: Submitting ampersands in forms... (1998)