How to list particular type of files from a specific directory? e.g. I want to list all *.csv files from /home/ABC/files/ directory and I am in /home directory right now.
TMTOWTDI.
(cd /home/ABC/files/; ls *.csv)
ls /home/ABC/files/*.csv | sed 's:.*/::'
ls /home/ABC/files/*.csv | xargs -n1 basename
ls /home/ABC/files/*.csv | rev | cut -d/ -f1 | rev
for i in /home/ABC/files/*.csv; do echo "${i##*/}"; done
ls ABC/files/*.csv
ls /home/ABC/files/*.csv
echo ABC/files/*.csv
echo /home/ABC/files/*.csv
using for loop
for file in ABC/files/*.csv
do
# further processing
done
and of course, the ever useful find.(GNU)
find ABC/file -type f -iname "*.csv" -printf "%f\n"
ls ABC/files/*.csv
ls /home/ABC/files/*.csv
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With