Bacula or Bareos query for all backup copies of files in a directory

A customer gave me a vague description of where some files that he needed restored were, and also a vague timeline for when they needed to be restored from. I wanted to give him a list of all the files under a specific path and moreover all the dates from whence those files were backed up.

First ID the Path you care about:

SELECT * FROM Path WHERE Path LIKE 'C:/YOUR/PATH/HERE%'

Make note of the resulting PathIds. In my case the ones I care about are 16221 and 16220.

SELECT File.FileId, Path.Path, Filename.Name, Job.StartTime
FROM File
INNER JOIN Path ON Path.PathId=File.PathId
INNER JOIN Filename ON File.FilenameId=Filename.FilenameId
INNER JOIN Job ON File.JobId=Job.JobId
WHERE
File.PathID='16221'
OR File.PathID='16220';

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>