How to resolve the algorithm Walk a directory/Non-recursively step by step in the Pop11 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 Pop11 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 Pop11 programming language

Source code in the pop11 programming language

lvars repp, fil;
;;; create path repeater
sys_file_match('*.p', '', false, 0) -> repp;
;;; iterate over files
while (repp() ->> fil) /= termin do
     ;;; print the file
     printf(fil, '%s\n');
endwhile;

  

You may also check:How to resolve the algorithm Call a function step by step in the Dragon programming language
You may also check:How to resolve the algorithm Leap year step by step in the PARI/GP programming language
You may also check:How to resolve the algorithm Zhang-Suen thinning algorithm step by step in the Phix programming language
You may also check:How to resolve the algorithm Proper divisors step by step in the BASIC programming language
You may also check:How to resolve the algorithm Isograms and heterograms step by step in the AppleScript programming language