diff --git a/potx.inc b/potx.inc
index 79d187c..70996d8 100644
--- a/potx.inc
+++ b/potx.inc
@@ -49,8 +49,10 @@ define('POTX_MODE_SINGLE', 2);
  *   Array to add the identified CVS file versions into
  * @param $installer_strings
  *   Array to add any installer time strings identified
+ * @param $strip_prefix
+ *   an integer denoting the number of chars to strip form filepath for output
  */
-function _potx_process_file($file, &$strings, &$file_versions, &$installer_strings) {
+function _potx_process_file($file, &$strings, &$file_versions, &$installer_strings, $strip_prefix = 0) {
 
   // Figure out the basename and extension to select extraction method.
   $basename = basename($file);
@@ -58,6 +60,9 @@ function _potx_process_file($file, &$strings, &$file_versions, &$installer_strin
 
   // Always grab the CVS version number from the code
   $code = file_get_contents($file);
+  if ($strip_prefix > 0) {
+    $file = substr($file, $strip_prefix);
+  }
   _potx_find_version_number($code, $file, $file_versions);
 
   // The .info files are not PHP code, no need to tokenize.
diff --git a/potx.module b/potx.module
index 622d164..7e4c5ae 100644
--- a/potx.module
+++ b/potx.module
@@ -100,16 +100,19 @@ function potx_select_form_submit($form_id, &$form) {
   //   sites/all/modules/i18n/i18n.module
   
   $pathinfo = pathinfo($form['module']);
+  $strip_prefix = 0;
   
   // A specific module file was requested.
   if ($pathinfo['extension'] == 'module') {
     $filename = basename($pathinfo['basename'], '.module');
     $files = _potx_explore_dir($pathinfo['dirname'] . '/', $filename);
+    $strip_prefix = 1 + strlen($pathinfo['dirname']);
     $outputname = $filename . '.pot';
   }
   // A directory name was requested.
   else {
     $files = _potx_explore_dir($form['module'] . '/');
+    $strip_prefix = 1 + strlen($form['module']);
     $outputname = $pathinfo['basename'] . '.pot';
   }
   
@@ -128,7 +131,7 @@ function potx_select_form_submit($form_id, &$form) {
   // Collect every string in affected files. Installer related strings are discared.
   $strings = $file_versions = $installer_strings = array();
   foreach ($files as $file) {
-    _potx_process_file($file, $strings, $file_versions, $installer_strings);
+    _potx_process_file($file, $strings, $file_versions, $installer_strings, $strip_prefix);
   }
   _potx_build_files($strings, $file_versions, POTX_MODE_SINGLE);
   _potx_write_files($outputname, 'attachment');
