Jump to content

Walk a directory/Recursively: Difference between revisions

No edit summary
Line 1,365:
if file.match re".*\.mp3":
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}}==
760

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.