How to resolve the algorithm Walk a directory/Non-recursively step by step in the TXR 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 TXR 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 TXR programming language
Source code in the txr programming language
(glob "/etc/*.conf")
("/etc/adduser.conf" "/etc/apg.conf" "/etc/blkid.conf" "/etc/brltty.conf"
"/etc/ca-certificates.conf" "/etc/colord.conf" "/etc/ddclient.conf"
"/etc/debconf.conf" "/etc/deluser.conf" "/etc/dnsmasq.conf" "/etc/ffserver.conf"
"/etc/fuse.conf" "/etc/gai.conf" "/etc/hdparm.conf" "/etc/host.conf"
"/etc/insserv.conf" "/etc/irssi.conf" "/etc/kernel-img.conf"
"/etc/kerneloops.conf" "/etc/knockd.conf" "/etc/ld.so.conf" "/etc/lftp.conf"
"/etc/logrotate.conf" "/etc/ltrace.conf" "/etc/mke2fs.conf" "/etc/mtools.conf"
"/etc/netscsid.conf" "/etc/nsswitch.conf" "/etc/ntp.conf" "/etc/pam.conf"
"/etc/pnm2ppa.conf" "/etc/popularity-contest.conf" "/etc/resolv.conf"
"/etc/rsyslog.conf" "/etc/sensors3.conf" "/etc/sysctl.conf" "/etc/ucf.conf"
"/etc/updatedb.conf" "/etc/usb_modeswitch.conf" "/etc/wodim.conf")
(mappend [iff (op ends-with ".conf") list] (get-lines (open-directory "/etc")))
("ddclient.conf" "gai.conf" "ucf.conf" "kernel-img.conf" "ltrace.conf"
"debconf.conf" "apg.conf" "adduser.conf" "mke2fs.conf" "colord.conf"
"kerneloops.conf" "fuse.conf" "hdparm.conf" "irssi.conf" "host.conf"
"ffserver.conf" "pam.conf" "sysctl.conf" "ld.so.conf" "dnsmasq.conf"
"insserv.conf" "brltty.conf" "deluser.conf" "netscsid.conf" "nsswitch.conf"
"mtools.conf" "wodim.conf" "updatedb.conf" "popularity-contest.conf"
"knockd.conf" "ntp.conf" "sensors3.conf" "resolv.conf" "blkid.conf"
"lftp.conf" "ca-certificates.conf" "usb_modeswitch.conf" "logrotate.conf"
"rsyslog.conf" "pnm2ppa.conf")
You may also check:How to resolve the algorithm One-time pad step by step in the Perl programming language
You may also check:How to resolve the algorithm Inheritance/Multiple step by step in the Ring programming language
You may also check:How to resolve the algorithm Program termination step by step in the Slate programming language
You may also check:How to resolve the algorithm Loops/With multiple ranges step by step in the RPL programming language
You may also check:How to resolve the algorithm Roots of unity step by step in the Java programming language