bookweevil

28 March 2008

Getting updatedb on cygwin to prune paths with spaces

Filed under: cygwin — Tags: — bookweevil @ 8:12 pm

On cygwin, updatedb often gives “Permission denied” errors (e.g. for “C:/System Volume Information”) andFile name too long” errors (e.g. for files in “/cygdrive/c/Documents and Settings/MyName/Local Settings/Temporary Internet Files”).

And attempts to use the “–prunepaths” option to avoid indexing these seem not to work due to the spaces in the filenames. But there is a fix … From the Cygwin mailing list comes the following tip — you can type something like

  updatedb  --prunepaths='/proc  /cygdrive/c/Documents.and.Settings/MyName/Local.Settings/Temp'

to avoid these — prunepaths accepts regular expressions, including the use of a dot (.) to represent any character including a space.

My fix looks something like the following (line breaks inserted for legibility):

updatedb  --prunepaths='/proc /cygdrive/c/program_disk/cygwin

 /cygdrive/c/Documents.and.Settings/[^/]*/Local.Settings/Temp

 /cygdrive/c/Documents.and.Settings/[^/]*/Local.Settings/Temporary.Internet.Files

 /cygdrive/c/Documents.and.Settings/[^/]*/Local.Settings/Application.Data/Mozilla/Firefox/Profiles/[^/]*/Cache

 /cygdrive/[^/]*/System.Volume.Information

 /cygdrive/c/data/System.Volume.Information

 /cygdrive/c/backup/System.Volume.Information

 /cygdrive/c/shared/System.Volume.Information

 /cygdrive/c/program_disk/System.Volume.Information

 /cygdrive/g

 /cygdrive/h '
Advertisements

2 Comments »

  1. Thanks. I was wondering how to do that.
    So either there is a config file which can be passed (need to RTM) or you could pass this on the command line using `cat file-containing-prunepaths`

    locate/updatedb are better than using google to index your desktop. As you can pipe the output from locate through whatever combo you like.

    Have Fun

    Paul

    Comment by PaulM — 4 April 2008 @ 8:53 pm

  2. Nice one, I’ve been looking for a solution to that for ages. What I found awkward was that the same updatedb with prunepaths behaves different on different systems, for example on my work XP Prof it runs fine, but on my home XP Home it wouldn’t.. until now.

    Cheers, Bog

    Comment by Bog — 28 January 2009 @ 12:45 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: