Lasso Soft Inc. > Home

[jc_eachVisibleFilePathRecursive]

Linkjc_eachVisibleFilePathRecursive
AuthorJolle Carlestam
CategoryFile
Version9.x
LicensePublic Domain
Posted12 Sep 2012
Updated12 Sep 2012
More by this author...

Description

Methods adding to the dir type that will allow dealing with only visible files or directories.

The built in method dir -> eachFilePathRecursive returns all files and directories found in the given path. Using dir -> eachVisibleFilePathRecursive will only return visible files and directories. Very useful if you for example want to get a listing without possible SVN directories in the path.

Sample Usage

local(tree = dir('/mypath/morepath/') -> jc_eachVisibleFilePathRecursive)
-> /_mypath/morepath/myfile.lasso, /_mypath/morepath/myimages/myimage.jpg

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.

 jc_eachVisibleFilePath() => {
	return with name in self->eachEntry where #name->second != io_dir_dt_dir where not(#name->first -> beginswith('.')) select .makeFullPath(#name->first)
}

define dir -> jc_eachVisibleDir() => {
	return with name in self->eachEntry where #name->second == io_dir_dt_dir where not(#name->first -> beginswith('.')) select dir(.makeFullPath(#name->first + '/'))
}

define dir -> jc_eachVisibleFilePathRecursive(-dirFilter = void) => {
	local(files = .jc_eachVisibleFilePath)
	with dir in .jc_eachVisibleDir
	where !#dirFilter || #dirFilter(#dir->realPath)
	do {
		#files = tie(#files, #dir->jc_eachVisibleFilePathRecursive(-dirFilter=#dirFilter))
	}
	return #files
}

?>

Comments

No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home

 

 

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