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

linux

Solution

The `-L` option to `ls` will accomplish what you want. It dereferences symbolic links.

So your command would be:

ls -LR

You can also accomplish this with

find -follow

The `-follow` option directs find to follow symbolic links to directories.

On Mac OS X use

find -L

as `-follow` has been deprecated.

Problem

Suppose I have a directory `/dir` inside which there are 3 symlinks to other directories `/dir/dir11`, `/dir/dir12`, and `/dir/dir13`. I want to list all the files in `dir` including the ones in `dir11`, `dir12` and `dir13`. To be more generic, I want to list all files including the ones in the directories which are symlinks. `find .`, `ls -R`, etc stop at the symlink without navigating into them to list further.

Original source

Related problems