Recursively list all files in a directory including files in symlink directories

后端 未结 8 940
甜味超标
甜味超标 2020-12-07 07:46

Suppose I have a directory /dir inside which there are 3 symlinks to other directories /dir/dir11, /dir/dir12, and /dir/dir13

8条回答
  •  青春惊慌失措
    2020-12-07 08:24

    find -L /var/www/ -type l
    
    # man find
    
    -L     Follow  symbolic links.  When find examines or prints information about files, the information used shall be taken from the
    

    properties of the file to which the link points, not from the link itself (unless it is a broken symbolic link or find is unable to examine the file to which the link points). Use of this option implies -noleaf. If you later use the -P option, -noleaf will still be in effect. If -L is in effect and find discovers a symbolic link to a subdirectory during its search, the subdirectory pointed to by the symbolic link will be searched.

提交回复
热议问题