SanMu
SanMu

Reputation: 765

List absolute path to FILES in given directory and all subdirectories

I am trying to list the absolute path to all files in a given directory and all its subdirectories. I can almost get there using

ls -LR | xargs realpath

The only issue is that this also includes the paths to the individual subdirectories followed by a colon, i.e.

/path/to/subdirectory:

However, I am only looking to get a list of paths to files. Can someone help out here?

Upvotes: 1

Views: 42

Answers (1)

Mureinik
Mureinik

Reputation: 312086

It's probably possible with some combination of ls and realpath, but I think that using find with a filter on the type will be much easier:

find . -type f

Upvotes: 0

Related Questions