Walk a directory/Non-recursively: Difference between revisions

→‎{{header|TXR}}: Solution with direct directory reading.
(→‎{{header|TXR}}: Solution with direct directory reading.)
Line 1,268:
 
=={{header|TXR}}==
 
==== Using <code>glob</code> ====
 
<lang txrlisp>(glob "/etc/*.conf")</lang>
Line 1,284 ⟶ 1,286:
"/etc/rsyslog.conf" "/etc/sensors3.conf" "/etc/sysctl.conf" "/etc/ucf.conf"
"/etc/updatedb.conf" "/etc/usb_modeswitch.conf" "/etc/wodim.conf")</lang>
 
==== Using <code>open-directory</code> and <code>get-lines</code> ====
 
<lang txrlisp>(mappend [iff (op ends-with ".conf") list] (get-lines (open-directory "/etc")))</lang>
 
{{out}}
 
<lang txrlisp>("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")</txrlisp>
 
=={{header|UNIX Shell}}==
543

edits