BASH:递归读取目录中的所有文件,包括符号链接 [英] BASH: Read all files in a directory recursively, includinging symbolic links

查看:81
本文介绍了BASH:递归读取目录中的所有文件,包括符号链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从某人那里得到了这个整洁的脚本:

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

这篇关于BASH:递归读取目录中的所有文件,包括符号链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆