Lasso Soft Inc. > Home

[ dir->eachDir ]

Method

The [dir->eachDir] method returns a list of [dir] objects that reference the directories contained in the directory that the original [dir] object represents. The return type is a [queriable_select] which allows you to work with it in query expressions.

  • Syntax
local(d) = dir(...)
#d->eachDir
Examples
  • Intermediate

List each directory and the number of items inside of them

The following code will display each directory path in the web-root and the number of files and directories they contain. For purposes of this example, assume that the web-root has the following directories: 'css', 'img', and 'js' each containing 2 files and 1 directory.

Code

local(web_root)  = dir('/')
with d in #web_root->eachDir
do {^
    '<p>' + #d->path + ' -- ' + #d->size + '</p>'
^}

Result

/css/ -- 3

/img/ -- 3

/js/ -- 3

Recent Comments

No Comments found

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft