Linux find command for a list of files or folders

Goal: Generate a simple text file with a list of files in it

find "/path/to/search" -type f | sort > list.txt

The -type f only returns files.

find /home/mruckman -maxdepth 1 -type d

The -type d only returns directories

Leave a Reply