Walk a directory/Recursively: Difference between revisions
Content deleted Content added
No edit summary |
|||
Line 1,365: | Line 1,365: | ||
if file.match re".*\.mp3": |
if file.match re".*\.mp3": |
||
echo file</lang> |
echo file</lang> |
||
=={{header|Objeck}}== |
|||
<lang objeck>use System.IO.File; |
|||
class Test { |
|||
function : Main(args : String[]) ~ Nil { |
|||
if(args->Size() = 2) { |
|||
DescendDir(args[0], args[1]); |
|||
}; |
|||
} |
|||
function : DescendDir(path : String, pattern : String) ~ Nil { |
|||
files := Directory->List(path); |
|||
each(i : files) { |
|||
file := files[i]; |
|||
if(<>file->StartsWith('.')) { |
|||
dir_path := String->New(path); |
|||
dir_path += '/'; |
|||
dir_path += file; |
|||
if(Directory->Exists(dir_path)) { |
|||
DescendDir(dir_path, pattern); |
|||
} |
|||
else if(File->Exists(dir_path)) { |
|||
if(dir_path->EndsWith(pattern)) { |
|||
dir_path->PrintLine(); |
|||
}; |
|||
}; |
|||
}; |
|||
}; |
|||
} |
|||
}</lang> |
|||
=={{header|Objective-C}}== |
=={{header|Objective-C}}== |