4

I am building a home made catalog/indexer of my PDF/DJVU/EPUB/LIT/unspecified files. I need only index the file names. Indexing contents are not needed as I always keep descriptive file names. The locate command does a good job and outputs the results (after I build the index with updatedb).

However I would like to see only genuine files, not directories. Can I manipulate locate into such a behavior?

Magguu
  • 143

1 Answers1

1

I'm not aware of any locate implementation that checks file types.

You can use Bash to filter the locate output:

while read -r -d $'\0' f
do
    [ -f "$f" ] && echo "$f"
done < <(locate -0 something)

Or you can use find with the -type f option:

find / -name something -type f