I would like to get a list of all the files in a directory hierarchy (like I would with ls -R
), but such that instead of listing the name of the directory and its files beneath it, it would just output a list of files with their full path. Is this possible?
Use find
for this type of thing.
find /home/me/subdir
will list all the files and directories, with full path, that live in /home/me/subdir
.
find /home/me/subdir -type f
will only list files. (-type d
for directories.)
If you need to match a filename glob, do like this:
find /home/me/subdir -type f -name "abc*"
Or exclude a file name pattern:
find /home/me/subdir -type f ! -name ".*"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With