From: Arno L. <al...@it...> - 2005-10-05 21:49:45
|
Hello, On 05.10.2005 22:52, Gilberto Nunes Ferreira wrote: > Hi folks... > > Since I'm not any expert in regex function, I decide make this question: > > "How can I make some regex to eliminate hide file and directory of backup?" > > Thanks... Ok, let's see. First, using options with exclude=yes in baculas configuration is something I never did, but from this mailing list I know that it's not exactly intuitive... so I guess you better prepare for some edit / reload / estimate sessions. RegEx: You should have some manual pages on your system elaborating on regular expressions. Basics: . matches anything - once. * means "the stuff before the * 0 or more times" + means "the stuff before the + 1 or more times" ^ is the beginning of a line $ is the end of a line \ escapes special characters like . or * [] are alternatives, and with ^ mean everyting except, so for example [0-9]+ matches all natural numbers (hope I've got the maths right :-) Other things should not be necessary for now. A regular expression that matches any full path where the last component begins with a . could, for example, be: ^.*/\.[^/]$ And, what you want, could look like ^.+/[^.][^/]+$ - this doesn't distinguish between directories and files, so you've got to think about that part. Personally, but that comes from before the RegEx matches were introduced in bacula, I used find to collect filesets with these characteristics. You can include the output from commands as a file set. Some examples: > arno@elf:/> # The following command finds all files not beinning with . , but also looks in .-directories > arno@elf:/> find ~arno/ -type f -regex '^.+/[^.][^/]+' -maxdepth 2 | head -n 5 > /home/arno/.qt/qtrc > /home/arno/.qt/qt_plugins_3.0rc > /home/arno/X.X > /home/arno/WWW/lehre.php3 > /home/arno/WWW/l_seite.php3 > arno@elf:/> # The next one only finds files in the home directory: > arno@elf:/> find ~arno/ -type f -regex '^.+/[^.][^/]+' -maxdepth 1 | head -n 5 > /home/arno/X.X > /home/arno/Sent > /home/arno/mbox > /home/arno/bilderliste_omakarten > /home/arno/CONCEX.CFG > arno@elf:/> # And, finally, one to find non-dot directories: > arno@elf:/> find ~arno/ -type d -regex '^.+/[^.][^/]+' -maxdepth 1 | head -n 5 > /home/arno/WWW > /home/arno/alb > /home/arno/bin > /home/arno/mca > /home/arno/Mail Note the use of head (so you don't have to read through all my untidy home-dir) and maxdepth. And, of course, find is a great tool to try regular expressions. Arno > > Acesse o link abaixo para conhecer nossa empresa: > http://www.selbetti.com.br/apresentacao > __________________________ > > > Nome: Gilberto Nunes - Analista de Suporte > Selbetti Equip. Escritorio Ltda > Fone = 441-6034 > www.selbetti.com.br > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: > Power Architecture Resource Center: Free content, downloads, discussions, > and more. http://solutions.newsforge.com/ibmarch.tmpl > _______________________________________________ > Bacula-users mailing list > Bac...@li... > https://lists.sourceforge.net/lists/listinfo/bacula-users > -- IT-Service Lehmann al...@it... Arno Lehmann http://www.its-lehmann.de |