15

I'm trying to use locate to find files, but I'm not getting anything back from the program. It can't even find files that are in the current directory. How do I make locate work?

Jens Erat
  • 18,485
  • 14
  • 68
  • 80
Phenom
  • 6,767

3 Answers3

15

In essence, you have to run updatedb first, as this builds the database that locate uses.
Simply do updatedb --localpaths=c:/ as a first shot solution.

See this blog post for a bunch of good tips, including how to setup up updatedb via cygwin cron: https://web.archive.org/web/20061114000822/www.weiqigao.com/blog/2006/08/14/ten_steps_to_higher_cygwin_productivity.html (updated link to archive.org)

Google cygwin updatedb for a relevant post if you are having trouble with paths that include spaces. I am not getting any trouble (other than permission denied) on WinXP Pro, but other platforms may require this.

dirkjot
  • 457
5

To use locate you need to run updatedb first.

-1

I think the command you want is find

Do man find to see the syntax and options

The locate command runs against a pre-built database of filenames

Ex Umbris
  • 1,219