On Wed, 24 Jan 2007, [EMAIL PROTECTED] wrote: > Could anyone help me out with writing an SQL query to find specified > directories? I'm trying to do something similar to query "#1" (List up to 20 > places where a File is saved regardless of the directory), but for directories. > I'm trying to find any backups where the last directory component has a > particular name. > > For example, I'm trying to write a query that would tell me that the directory > named "fred" exists in backups of the following: > > server1-fd:/export/home/fred > server2-fd:/public/research/ProjectFoo/collaborators/fred > Fred_workstation-fd:/Documents and Settings/fred
My quick-n-dirty MySQL query for this: select DISTINCT fs.FileSetId, fs.FileSet, fs.CreateTime, p.Path from FileSet fs, Job j, File f, Path p where p.Path like '%/fred/' and f.PathID=p.PathID and j.JobID=f.JobID and fs.FileSetID=j.FileSetID; Performing this search on a directory I know exists in my database: mysql> select DISTINCT fs.FileSetId, fs.FileSet, fs.CreateTime, p.Path from FileSet fs, Job j, File f, Path p where p.Path like '%113660000/' and f.PathID=p.PathID and j.JobID=f.JobID and fs.FileSetID=j.FileSetID; +-----------+------------+---------------------+---------------------------------+ | FileSetId | FileSet | CreateTime | Path | +-----------+------------+---------------------+---------------------------------+ | 3 | xRaid1 | 2007-01-08 15:41:22 | /data/staging/xRaid1/113660000/ | | 5 | xRaid1_pt1 | 2007-01-18 11:16:12 | /data/staging/xRaid1/113660000/ | +-----------+------------+---------------------+---------------------------------+ 2 rows in set (3 min 19.71 sec) Hope this helps... -- D ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users