23 lines
492 B
Plaintext
23 lines
492 B
Plaintext
Class Utils.File [ Abstract ]
|
|
{
|
|
|
|
ClassMethod WalkTree(pDir As %String = "", pMask As %String = "*.*") As %Status
|
|
{
|
|
// do some validation
|
|
If pDir="" Quit $$$ERROR($$$GeneralError, "No directory specified.")
|
|
|
|
// search input directory for files matching wildcard
|
|
Set fs=##class(%ResultSet).%New("%File.FileSet")
|
|
Set sc=fs.Execute(pDir, pMask)
|
|
While (fs.Next()) {
|
|
Write !, fs.Name
|
|
// sub-directory
|
|
If fs.Type="D" Set sc=..WalkTree(fs.Name, pMask)
|
|
}
|
|
|
|
// finished
|
|
Quit $$$OK
|
|
}
|
|
|
|
}
|