3

I have a few hard drives which are connected to a Linux machine or a OS X machine. Not all hard drives can be connected at the same time. I have access via ssh to all machines from each other.

I would like to be able to find whether there is a file that matches approximately or exactly a filename, whether the hard drive is currently mounted or not. I would also like to have the database to update automatically when the drive is mounted, knowing that it can be mounted on all machines.

1

The following solution might be a better fit for Super User, but still:

When connecting the machines to a Linux machine, you could mount the drives to specific mount-points in your directory structure. If you do that via a script, you could include a call to the updatedb script of Locate – a software that ships with most Linux distributions. Additionally make sure that updatedb script (usually linked from /etc/cron.daily) does not run when those drives are not connected (to avoid having their content purged).

Then, from the Linux command line, you could simply use locate myfilename to locate every file including "myfilename" in its name – which would apply e.g. to myfilename.txt, also_myfilename.jpg, myfilename_too.mp4, etc. On which machine/drive the file is located, then becomes obvious by the path returned, e.g. /mnt/machine1/drive_a/home/myuser/myfilename.txt – provided you organized your mount points accordingly.

  • cost: free
  • installation: if not pre-installed already, simply use your package manager
  • matches full or partly filename
  • does however not match wildcards IMHO, and for sure not "soundex" (sounds the same/closely similar, but is spelled differently)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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