Tuesday 10 November 2009

Excluding files and folders

I just got a question about excluding files, and I thought I'd post the response in case anyone else finds it useful.

You can exclude things using a more complicated Java regular expression in the search function: http://sites.google.com/site/thebackupmonkey/help/searches. Do a search based on a regular expression, and then include the search (which is saved as a location) in your backup by dragging and dropping it in.

Have a look at the comments here for an example: http://thebackupmonkey.blogspot.com/2009/09/using-searches-to-backup-files.html. Note that "^" is both the start of a line (at the start of a regular expression) and a negation (in the character class: http://java.sun.com/docs/books/tutorial/essential/regex/char_classes.html).

A simpler exclude option would be a nice feature to add! It's on the (long, growing) TODO list.

2 comments:

Oscar said...

I hate myself a little for commenting on such an old topic... but here it is:
I've spent the last 2 hours trying different things, and I can't seem to get it to work the way I am expecting it to. I don't have much of a programming background, but I figure out complex problems all the time, it really shouldn't be this hard!

I am trying to exclude files ending in lck (as in vmware lck files) from the backup, as they are causing failure notifications every night. I've read the tutorial that was linked, the bonkey documentation, web examples, etc. I've tried a lot of variations but I would expect that something like ^[*lck] or [^lck] or similiar would be sufficient, but apparently not. Any help would be appreciated. I've used the examples and resources I've been able to find and haven't found them helpful. Any pointers, tips, or additional resources that put me in the right direction would be really great.

BTW - I love the rest of the program. Hadn't even heard of it a few months ago.

bonkey said...

Hi Oscar,

Sorry for the delay.

This is a tough problem. The real solution is for Bonkey to have a "doesn't match" option in the UI, which would make the regex much simpler.

In the meantime, here's something that should work:

^.*[^l][^c][^k]$

^ means start of the line. .* matches any string of any length. [^l] means any character except l; [^c] any character except c; [^k] any character except k. $ is the end of the line.

Nasty.

Bonkey