Dark's Code Dump

Possibly useful

Get full recursive directory listings from a list of folders in a text file (Linux)

Googled for a while and couldn't find any linux bash-free (for shoving in a crontab) one-liners to do as per title.

To help people find this, some of the things I searched for:

  • recursive list files matching list of names
  • ls all directories in text file
  • bash recursive list files from text file

The solution was to (ab)use rsync:

rsync -r --files-from=your-list-of-files-and-folders.txt --dry-run --itemize-changes --out-format='%n' /your/base/directory /tmp > result.txt

It will recurse into any directories in the given --files-from text file and print the paths of everything to stdout.

Leave a Reply