On Tue, 13 Feb 2007, Thor Vik wrote:

> Does anyone know of a good SQL guide to restore files for bacula? I want
> to restore eg. all mp3 files (*.mp3) and want to write sql for this. :-)

My first thought (not having done a lot of multi-file restores in Bacula) 
is that you'd probably want to dump the list of mp3s to a text file, and 
then call that in bconsole with restore option #7.

If you're using MySQL, you can use the following query to build a list of 
paths and filenames:

SELECT p.Path, fn.Filename FROM p Path, fn Filename, f File WHERE 
fn.Filename LIKE '%.mp3' AND f.FilenameID = fn.FilenameID and p.PathID = 
f.PathID INTO OUTFILE '/tmp/mp3_filez.out';

You'll end up with a list like:

/directory/<TAB>filename.mp3

Do some magic to make those <TAB>s disappear (awk is a wonderful thing, as 
is perl), then go into bconsole, type 'restore', choose option 7, and 
enter '</tmp/mp3_filez.out' as your first filename.

Note: I *think* this should work. No guarantees. Also? This may not be the 
fastest way, but it seems pretty solid to me. If you're not using MySQL... 
well, the basic idea will be the same, but the exact syntax of the SQL 
query might be different.

-- D


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to