How to resolve the algorithm Walk a directory/Non-recursively step by step in the UNIX Shell 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 UNIX Shell 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 UNIX Shell programming language
Source code in the unix programming language
ls -d *.c # *.c files in current directory
(cd mydir && ls -d *.c) # *.c files in mydir
You may also check:How to resolve the algorithm Greatest common divisor step by step in the K programming language
You may also check:How to resolve the algorithm First power of 2 that has leading decimal digits of 12 step by step in the Haskell programming language
You may also check:How to resolve the algorithm Ethiopian multiplication step by step in the Wren programming language
You may also check:How to resolve the algorithm Call a function in a shared library step by step in the R programming language
You may also check:How to resolve the algorithm ISBN13 check digit step by step in the FreeBASIC programming language