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 '

Blog at WordPress.com.