команда ls - перечисляет файлы, содержащие определенную строку в имени файла, и принадлежит определенному типу

Это - на самом деле путь find работы по умолчанию. Вы могли просто работать

find A/ -name "*.jil" -exec cp {} target_dir/ \;

Поведение по умолчанию find должен изучить все подкаталоги рекурсивно, можно управлять этим путем установки -maxdepth/-midepth опции:

   -maxdepth levels
          Descend at most levels (a non-negative integer) levels of direc‐
          tories below the command line arguments.  -maxdepth 0
           means only apply the tests and  actions  to  the  command  line
          arguments.
   -mindepth levels
          Do  not apply any tests or actions at levels less than levels (a
          non-negative integer).  -mindepth  1  means  process  all  files
          except the command line arguments.
2
29.08.2018, 14:30
1 ответ

С помощью ls вы можете:

ls -c -ltd -- *PRO*.PLI

С помощью find :

find . ! -name . -prune -type f -name '*PRO*.PLI'

(обратите внимание, что find будет включать скрытые файлы, такие как .xPRO.PLI , в то время как глобус оболочки ( * PRO * .PLI ) не будет по умолчанию).

7
27.01.2020, 21:52

Теги

Похожие вопросы