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

后端 未结 8 921
甜味超标
甜味超标 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:31

    find /dir -type f -follow -print
    

    -type f means it will display real files (not symlinks)

    -follow means it will follow your directory symlinks

    -print will cause it to display the filenames.

    If you want a ls type display, you can do the following

    find /dir -type f -follow -print|xargs ls -l
    

提交回复
热议问题