How to resolve the algorithm Walk a directory/Non-recursively step by step in the Lingo programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Walk a directory/Non-recursively step by step in the Lingo programming language
Table of Contents
Problem Statement
Walk a given directory and print the names of files matching a given pattern.
(How is "pattern" defined? substring match? DOS pattern? BASH pattern? ZSH pattern? Perl regular expression?)
Note: This task is for non-recursive methods. These tasks should read a single directory, not an entire directory tree.
Note: Please be careful when running any code presented here.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Walk a directory/Non-recursively step by step in the Lingo programming language
Source code in the lingo programming language
-- Usage: printFiles("C:\scripts", ".ls")
on printFiles (dir, fileType)
i = 1
sub = fileType.length -1
repeat while TRUE
fn = getNthFileNameInFolder(dir, i)
if fn = EMPTY then exit repeat
i = i+1
if fn.length
if fn.char[fn.length-sub..fn.length]=fileType then put fn
end repeat
end
You may also check:How to resolve the algorithm Terminal control/Clear the screen step by step in the OCaml programming language
You may also check:How to resolve the algorithm Here document step by step in the V (Vlang) programming language
You may also check:How to resolve the algorithm Nonoblock step by step in the JavaScript programming language
You may also check:How to resolve the algorithm Dragon curve step by step in the M4 programming language
You may also check:How to resolve the algorithm Long multiplication step by step in the Nim programming language