我有一个包含以下文件夹的文件夹:
是否有任何方法在通过文件夹A访问文件夹B后忽略文件夹B?
非常感谢!
- 文件夹 A
- 文件夹 B(符号链接到文件夹 A)
是否有任何方法在通过文件夹A访问文件夹B后忽略文件夹B?
非常感谢!
$ find -L /some/path
find: File system loop detected; `/some/path/link' is part of the same file system loop as `/some/path'.
来自 man 页面:
The find utility shall detect infinite loops; that is,
entering a previously visited directory that is an ancestor of
the last file encountered. When it detects an infinite loop,
find shall write a diagnostic message to standard error and
shall either recover its position in the hierarchy or
terminate.
fts_open()
为您提供了一个易于使用的迭代器,用于遍历所有子目录内容,同时还检测到这样的符号链接递归。