How can I do foreach *.mp3 file recursively in a bash script?

后端 未结 5 1341
你的背包
你的背包 2020-12-09 19:53

The following works fine within the current folder, but I would like it to scan sub folders as well.

for file in *.mp3

do

echo $file

done
5条回答
  •  既然无缘
    2020-12-09 20:35

    find . -name *.mp3 -exec echo {} \;
    

    The string {} is replaced by the current file name being processed everywhere it occurs in the arguments to the command, not just in arguments where it is alone, as in some versions of find.

    Please check the find man for further info http://unixhelp.ed.ac.uk/CGI/man-cgi?find

提交回复
热议问题