How to specify a specific type of files from a specific directory? for example, I want to list all * .csv files from the directory / home / ABC / files /, and now I'm in / home.
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, always a useful find. (GNU)
find ABC/file -type f -iname "*.csv" -printf "%f\n"
ls ABC/files/*.csv ls /home/ABC/files/*.csv
Source: https://habr.com/ru/post/1336269/More articles:Visual studio 2010 C ++ code coverage tool - unit-testingwhat is @private? and what is its use? - objective-cOne ESC closes all modal dialogs in the jQuery user interface. Workarounds? - javascriptThe doubt that life failure can be avoided is discussed in Effective Java - javaSeparate working directories between applications - appdomainOracle: Schedule List - sqlCreate a scaffold by skipping a model - ruby | fooobar.comMySQL: how to change varchar (255) UNIQUE column to UNIQUE Text NOT NULL? - sqlasp mvc using dashes in controller and routing names? - urlC-linked functions capable of returning a class type? - c ++All Articles