The pithy ruminations from Phil Stracchino <ala...@metrocast.net> on "Re: [Bacula-users] Searching for files" were:
=> On 10/22/10 02:47, ladolf wrote: => > I would also like to know the answer to this question. Sometimes I => > need to restore a file and I know part of file name. I don't know => > which letters are upper case. If I know which job to use then I use => > "restore" command in bconsole. I select the option "Enter list of => > comma separated JobIds to select" or "Select the most recent backup => > for a client". Then I use "find" command. But I cannot find any help => > for "find" command (unless the string saying that I can use => > wildcards). And it is case sensitive. It would be great if the => > command would support regular expressions. Sometimes I need to list => > many folders to find the file. => > => > If I don't know when the file has been backed up then this task can => > be really tedious. I have to search in many jobs. There is an option => > in restore that says "List Jobs where a given File is saved". But in => > this case you have to know the exact filename. And even with this I => > cannot see this command working. => > => > Maybe anyone knows how to query the bacula database directly to get => > search result for a file. => => At the simplest possible level: start up bconsole, use the SQL query => function, and enter this query: Wow. Could you please re-read this, and consider whether this is really the "simplest possible level"? I think I understand what you mean, but it's far from "simple". In my experience with Bacula, the most frequent request from users for restores is something like: I accidently removed all the "dat" files from /foo/bar. Could you please restore them? I've always felt that the restore menu and choices in bacula seem to be oriented around the way bacula works (ie., supplying a list of JobIds), rather than around the way that humans work (ie., restore all "dat" files from /foo/bar and below, without specifying an exact list of files). => => SELECT FROM Filename where Name like "%what you know of the filename here%"; => => That is case insensitive, and % in a SQL query is a wildcard. If you => know something of the path where the file should be, you can search for => that in the Path table the same way to narrow it down. => => You could combine the name and path queries to make a more complex query => like this: => => SELECT DISTINCT p.Path, n.Name FROM Path AS p, Filename AS n, File AS f => WHERE f.FilenameId = n.FilenameId AND f.PathId = p.PathId AND n.Name => LIKE "%partial filename%" AND p.Path LIKE "%partial path%" ORDER BY => p.Path, n.Name; => => This query could also be performed as: => => SELECT DISTINCT Path, Name FROM File LEFT JOIN Path ON File.PathId = => Path.Pathid LEFT JOIN Filename ON File.FilenameId = Filename.FilenameId => WHERE Name LIKE "%partial filename%" AND Path LIKE "%partial path%" => ORDER BY Path, Name; => I'm sure that those examples work--and are much better than my poor attempts to write SQL to do similar queries. That'll be a big help. However, given what a common use-case this is for any backup system, it would be nice if the bacula restore process was more user-friendly. Thanks, Mark => => ---- Mark Bergman voice: 215-662-7310 mark.berg...@uphs.upenn.edu fax: 215-614-0266 System Administrator Section of Biomedical Image Analysis Department of Radiology University of Pennsylvania PGP Key: https://www.rad.upenn.edu/sbia/bergman The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. ------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev _______________________________________________ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users