I run dirvish hourly on my local system, and keep the backup filesystem mounted 
(read-only) in between backups so I can easily go back and find old copies of 
files. I use a relatively long expire time (keep hourly for a week, then daily 
for 3 months, then weekly etc.). This means my vault has quite a long list of 
images. To keep my vault easier to browse, I like to use subdirectories. 
Here's my image-default line from master.conf:

image-default: %Y/%m/%d/%H:%M

Unfortunately, dirvish doesn't allow for subdirectories like this, because it 
uses mkdir to create the image directory. I made a pretty simple change to my 
local copy of dirvish which fixed the issue: use Perl's mkpath instead of 
mkdir. (mkpath is the Perl version of mkdir -p.)

This was discussed quite a while ago on the list: 
http://www.dirvish.org/pipermail/dirvish/2007-August/001441.html

Since it obviously didn't get included as a result of that discussion, I'd 
like to provide a patch. I know that dirvish is not actively maintained but 
this seems like a safe change that is completely backwards-compatible. Even if 
it doesn't get incorporated it might help anyone else who'd be interested in 
the same functionality modify their own local version.

I generated the patch against 1.3.1, but it should be pretty easy to apply 
manually regardless of what version you use.

--- dirvish-1.3.1       2009-12-12 12:35:49.234684492 -0600
+++ dirvish-1.3.1-new   2009-12-12 12:37:05.324688884 -0600
@@ -58,10 +58,11 @@
 
 use POSIX qw(strftime);
 use Getopt::Long;
 use Time::ParseDate;
 use Time::Period;
+use File::Path;
 
 use DirvishHack;     # this will change a lot during development
 
 @rsyncargs = qw(-vrltH --delete);
 
@@ -422,12 +423,12 @@
 scalar @{$$Options{exclude}}
     and push @rsyncargs, '--exclude-from=' . $exl_file;
 
 if (!$$Options{'no-run'})
 {
-    mkdir "$vault/$image", 0700
-        or seppuku 230, "mkdir $vault/$image failed";
+    mkpath "$vault/$image", 0700
+        or seppuku 230, "mkpath $vault/$image failed";
     mkdir $destree, 0755;
 
     open(SUMMARY, ">$vault/$image/summary")
         or seppuku 231, "cannot create $vault/$image/summary"; 
 } else {



-Andy Feldman

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Dirvish mailing list
[email protected]
http://www.dirvish.org/mailman/listinfo/dirvish

Reply via email to