How to perform a for-each loop over all the files under a specified path?

前端 未结 4 501
粉色の甜心
粉色の甜心 2020-12-02 07:00

The following command attempts to enumerate all *.txt files in the current directory and process them one by one:

for line in \"find . -iname \'         


        
4条回答
  •  一生所求
    2020-12-02 07:45

    More compact version working with spaces and newlines in the file name:

    find . -iname '*.txt' -exec sh -c 'echo "{}" ; ls -l "{}"' \;
    

提交回复
热议问题