Re: [Bacula-users] How to find all file .avi from full tape

2010-05-31 Thread Mike Holden
Simone Martina wrote:
 Thanks for your suggestions, I propose a query made with help of a
 friend of mine:
 SELECT CONCAT(Path.Path,Filename.Name) FROM Filename Inner Join File
 ON
 Filename.FilenameId = File.FilenameId Inner Join Path ON File.PathId
 =
 Path.PathId where (Filename.Name LIKE %avi) OR (Filename.Name LIKE
 %AVI) OR (Filename.Name LIKE %mpeg) OR (Filename.Name LIKE
 %MPEG)
 OR (Filename.Name LIKE %mpg) OR (Filename.Name LIKE %MPG);

You can simplify the multiple instances of the same extension in
different cases by using UPPER() like this:

OR UPPER((Filename.Name LIKE %MPG))

-- 
Mike Holden

http://www.by-ang.com - the place to shop
for all manner of hand crafted items,
including Jewellery, Greetings Cards and Gifts


--

___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] How to find all file .avi from full tape

2010-05-28 Thread Graham Keeling
On Fri, May 28, 2010 at 10:47:00AM +0200, Simone Martina wrote:
 Hi at all,
 someone of my colleagues tends to save non-work files (like large avi 
 file) in shared directory and so my bacula backup Job take a lot of time 
 due to save these unuseful rubbish... I would like to find full path of 
 something file name contaings avi or AVI, has bconsole a sort of command 
 for these type of query, or should I do a query directly to mysql?

I had to do something similar yesterday. I don't know how to do it with
bconsole.

I ended up running something like this...

SELECT DISTINCT p.Path, fn.Name FROM Path p, File f, Filename fn
WHERE p.PathId=f.PathId AND fn.FilenameId=f.FileId AND
(p.Path LIKE '%avi%' OR fn.Name LIKE '%avi%');

...or maybe this...

SELECT DISTINCT p.Path, fn.Name FROM Path p, File f, Filename fn
WHERE p.PathId=f.PathId AND fn.FilenameId=f.FileId AND
fn.Name LIKE '%.avi';

You have to add more table joins to get the job and client out.


--

___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] How to find all file .avi from full tape

2010-05-28 Thread Graham Keeling
On Fri, May 28, 2010 at 10:12:51AM +0100, Graham Keeling wrote:
 On Fri, May 28, 2010 at 10:47:00AM +0200, Simone Martina wrote:
  Hi at all,
  someone of my colleagues tends to save non-work files (like large avi 
  file) in shared directory and so my bacula backup Job take a lot of time 
  due to save these unuseful rubbish... I would like to find full path of 
  something file name contaings avi or AVI, has bconsole a sort of command 
  for these type of query, or should I do a query directly to mysql?
 
 I had to do something similar yesterday. I don't know how to do it with
 bconsole.
 
 I ended up running something like this...
 
 SELECT DISTINCT p.Path, fn.Name FROM Path p, File f, Filename fn
 WHERE p.PathId=f.PathId AND fn.FilenameId=f.FileId AND
 (p.Path LIKE '%avi%' OR fn.Name LIKE '%avi%');
 
 ...or maybe this...
 
 SELECT DISTINCT p.Path, fn.Name FROM Path p, File f, Filename fn
 WHERE p.PathId=f.PathId AND fn.FilenameId=f.FileId AND
 fn.Name LIKE '%.avi';
 
 You have to add more table joins to get the job and client out.

...actually, the JobId is in the File table, so that is easy:

SELECT DISTINCT f.JobId, p.Path, fn.Name FROM Path p, File f, Filename fn
 WHERE p.PathId=f.PathId AND fn.FilenameId=f.FileId AND
 fn.Name LIKE '%.avi';


--

___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] How to find all file .avi from full tape

2010-05-28 Thread Simone Martina
Thanks for your suggestions, I propose a query made with help of a 
friend of mine:
SELECT CONCAT(Path.Path,Filename.Name) FROM Filename Inner Join File ON 
Filename.FilenameId = File.FilenameId Inner Join Path ON File.PathId = 
Path.PathId where (Filename.Name LIKE %avi) OR (Filename.Name LIKE 
%AVI) OR (Filename.Name LIKE %mpeg) OR (Filename.Name LIKE %MPEG) 
OR (Filename.Name LIKE %mpg) OR (Filename.Name LIKE %MPG);

Now, I bring up the reasoner (http://wggw.bellobello.it/macek.jpg) and 
will go to talk to some of my collegues :-P.

Simone

--

___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users