BASH: Read all files in a directory recursively, includinging symbolic links

十年热恋 提交于 2019-12-11 14:07:38

问题


I got this tidy script from someone:

find  ../Classes -name \*.cpp -print

which simply loops a directory, and prints all files recursively. However, it doesn't follow symlinks. All I can find online is:

find ../Classes -name \*.cpp -type l -print

But, since the directory is the symlink, not the files, it outputs nothing. How can I solve that?


回答1:


Tell find to follow symlinks with -L

find  -L ../Classes -name \*.cpp -print


来源:https://stackoverflow.com/questions/16693828/bash-read-all-files-in-a-directory-recursively-includinging-symbolic-links

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!