Index: trunk/DataStore/scripts/dsget
===================================================================
--- trunk/DataStore/scripts/dsget	(revision 15082)
+++ trunk/DataStore/scripts/dsget	(revision 15085)
@@ -3,5 +3,5 @@
 # Copyright (C) 2006  Joshua Hoblitt
 #
-# $Id: dsget,v 1.5 2007-09-28 21:05:16 jhoblitt Exp $
+# $Id: dsget,v 1.6 2007-09-28 21:10:58 jhoblitt Exp $
 
 use strict;
@@ -48,9 +48,12 @@
 # can we truely write to filename?
 {
-    # open file for ready/write but not create
+    # open file for read/write but not create
     my $fh;
     if (open($fh, '+<', $filename)) {
         # do nothing and fall through
     } elsif (open($fh, '>>', $filename)) {
+        # this is the "stomp on it behavior" this probably shouldn't be the
+        # default and it may make sense to check the md5sum/bytes count of the
+        # files that's already in place to see if we really need to re-fetch it
         unlink $filename or die "can't unlink $filename: $!";
     } else {
@@ -59,6 +62,13 @@
 }
 
+my $dirname = dirname($filename);
+
+if (!-d $dirname) {
+    # create path and possibly fix up permissions
+    mkpath([$dirname], 1, 0775);
+}
+
 my $tmp = File::Temp->new(
-    DIR         => dirname($filename),
+    DIR         => $dirname,
     TEMPLATE    => '.' . basename($filename) . 'XXXX',
     SUFFIX      => '.tmp',
