简体   繁体   English

BASH:递归读取目录中的所有文件,包括符号链接

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

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? 我怎么解决这个问题?

告诉find使用-L跟随符号链接

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM