--- drush_views.drush.inc	2010-03-14 04:45:59.000000000 -0500
+++ drush_views.drush.inc.new	2010-03-17 11:00:54.000000000 -0500
@@ -118,7 +118,20 @@ function drush_views_export($views = NUL
   drush_log(dt("Exporting !count views to directory @target_path:",
               array('!count' => count($exports), '@target_path' => $target_path)),
             'ok');
-  @mkdir($target_path, 0777, TRUE);
+
+  // Create the directory with the parent directory's permissions by default.
+  $parent_dir = $target_path;
+  while (!is_dir($parent_dir)  && ($parent_dir != conf_path())) {
+    // Make sure directory is valid to prevent loops.
+    if ($parent_dir && ($parent_dir != ".")) {
+      $parent_dir = dirname($parent_dir);
+    }
+    else {
+      // Default to Drupal path if the path was invalid or empty.
+      $parent_dir = conf_path();
+    }
+  }
+  @mkdir($target_path, fileperms($parent_dir), TRUE);
   foreach ($exports as $export) {
     $filename=$target_path ."$export->name.view";
     drush_log(dt("- Exporting view @name to file @filename.",
