Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking for an open-source (command-line) tool to register and search all my (backup) drives on a file name level. I want to search for file and folder names preferably written as regular expressions or file glob patterns. The external drives contain just normal HFS and NTFS filesystems. The backups are done via direct file copy.

Requirement is that the tool compiles on OS X and works without each of the drives attached, but rather pointing me to the drive in case a drive contains a file with the pattern I searched for.

At the moment I use a hand-knit script solution with locate databases, one for each external backup drive, but this is rather cumbersome, because locate itself can accesses only one database at a time and does not contain any management system for all the indices/databases.

Are there any other tools out there for this?

share|improve this question

closed as off topic by John Gardeniers, Zoredache, Magellan, sysadmin1138 Oct 19 '12 at 19:50

Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

Product recommendations (AKA "shopping" questions) are explicitly off topic. – John Gardeniers Oct 18 '12 at 7:24
Just saw something similar the other day. Take a look at git-annex. – Zoredache Oct 18 '12 at 7:35
It might help to know what kind of backup process you use. – itsbruce Oct 18 '12 at 7:52
@Zoredache git-annex looks interesting. Seems to be more geared towrds source code than whole drives, but it's a great tip! – halloleo Oct 18 '12 at 21:10
@JohnGardeniers Thanks. Are "tool suggestion" questions off topic for all of stackexchange? – halloleo Oct 18 '12 at 21:13

Wouldn't it be easier to modify your scripted solution according to your needs? For instance you could store your backup indexes in one directory (e.g. /var/local/backupindex) and make the wrapper script around locate do something like this:



case "$1" in
    for db in "$db_dir"; do
      db_name="$(basename "$db")"
      last_changed="$(stat -f "%m" "$db")"
      for pattern in "$@"; do
        locate -d "$db" "$pattern" | sed "s/.*/$db_name ($last_changed): &/"
    # add code to derive $db_name from external drive identifier, e.g.:
    #sn=$(system_profiler SPUSBDataType | awk '/Serial/ {print $3}')
    #[[ $sn =~ 123456 ]] && db_name=sn_123456.db
    updatedb --localpaths='/mount/point' --output=$db_name
    echo "Unknown subcommand: $1" 1>&2
    exit 1

exit 0

That will prepend each match locate returns with the name of the database file and the date that file was last modified. By making the first argument a subcommand you can implement query, update, cleanup, ... in the same script.

share|improve this answer
Yep, that's a solution with locate very similar to what I'm using. However I am hoping for a tool which manages (delete, update on connect, etc) the indices as well. – halloleo Oct 18 '12 at 21:11
It shouldn't be too difficult to add those features to your existing solution (see my updated answer). – Ansgar Wiechers Oct 18 '12 at 22:06

Not the answer you're looking for? Browse other questions tagged or ask your own question.