Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am looking for a Linux tool to search for files on offline media like CDs and DVDs. I know there are a lot of "cataloging" tools, but those are all graphical and I want a command line program. Ideal would be if works just like the well-known locate/updatedb bundle, with the only exception that the db update would have to be interactive, so that you can enter some id or description to a media, which will be printed by the locate-like tool, e.g.

$ medialocate foo.png
MEDIA_DVD_01:/pictures/misc/foo.png
MEDIA_DVD_08:/photos/foo.png
MEDIA_DVD_08:/img/bar/foofoo.png

Does such a tool exist yet? I haven't found anything, but this probably due to the fact that terms like "locale"/"cd"/"files"/"catalog" are just too common to yield good results. It wouldn't be too hard to write something like that myself, but I don't want to reinvent the wheel here.

share|improve this question

migrated from stackoverflow.com Aug 21 '09 at 20:35

This question came from our site for professional and enthusiast programmers.

    
Probably better for SuperUser.com –  EBGreen Aug 21 '09 at 19:55
add comment

3 Answers

You can use updatedb to have it parse the removable media paths, just configure accordingly the PRUNEPATHS and PRUNEFS environment variables in /etc/updatedb.conf or equivalent. Although this will only remember the path so if you mount in the same directory a different media and have updatedb run, it'll overwrite (or append?) the files.

You can workaround this by mounting each of your CDs to be catalogued in its own directory, not very hard, but a bit of a nuisance.

share|improve this answer
add comment

I use a shell script along the lines of:

#!/bin/bash
find $1 -type f -exec xmler.sh {} + > out.xml

Where xmler creates:

<file>
    <filename>someFilename.txt</filename>
    <md5sum>xxxxxxxxxxxx</md5sum>
    <date_modified>....</date_modified>
</file>

The file entries get wrapped in

<catalogue type="dvd" diskid="someid"></catalogue>

and so on, into an XML document. I can then write tools to create HTML catalogues and indexes, search tools and more.

A bit hackish, but works for me.

share|improve this answer
add comment

My particular solution to that is to use isoinfo from wodim to generate files in a ~/dvddb/ directory, with the label of the DVD as the filename (if you don't use RockRidge extensions, change -lR to -lJ):

isoinfo -lR -i /dev/scd0 > ~/dvddb/xxx.txt

Then, to find some file:

grep -i 'name' ~/dvddb/*

You may want to create shell aliases.

share|improve this answer
    
you should be able to use ls -R > ~/dvddb/disc_name.txt if you want to avoid extra tools –  Pär Björklund Aug 21 '09 at 22:21
1  
Pär: Sure. I prefer isoinfo because it lists the disc contents without mounting it. I run it right after I burn the disc, it is very handy in this sense. –  Juliano Aug 22 '09 at 4:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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