Begin work on handling of non-email files in the production.
This commit is contained in:
		
							parent
							
								
									beafad9259
								
							
						
					
					
						commit
						eb37c59129
					
				
					 1 changed files with 25 additions and 2 deletions
				
			
		|  | @ -87,6 +87,26 @@ if ($GROUP_NAMES_BY_DIR{$GROUP} eq 'PRIVILEGE') { | ||||||
| 
 | 
 | ||||||
| my @CSV_OUTPUT_ROWS; | my @CSV_OUTPUT_ROWS; | ||||||
| 
 | 
 | ||||||
|  | sub ProcessDocumentDirectory($$$); | ||||||
|  | 
 | ||||||
|  | sub ProcessDocumentDirectory($$$) { | ||||||
|  |   my($rfp, $inputDocDir, $numberedOutputDir) = @_; | ||||||
|  | 
 | ||||||
|  |   opendir(my $inputDH, $inputDocDir); | ||||||
|  |   while (my $file = readdir $inputDH) { | ||||||
|  |     next if $file =~ /^\s*\.\.?\s*$/; | ||||||
|  |     my $fullFilePath = catfile($inputDocDir, $file); | ||||||
|  |     if (-d $fullFilePath) { | ||||||
|  |       ProcessDocumentDirectory($rfp, $fullFilePath, catfile($numberedOutputDir, $file)); | ||||||
|  |     } elsif (-f $fullFilePath) { | ||||||
|  |       print "     mv $fullFilePath ", catfile($numberedOutputDir, $file), "\n"; | ||||||
|  |     } else { | ||||||
|  |       die("\"$fullFilePath\" is a strange file type, not handled!"); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |   closedir $inputDH; | ||||||
|  | } | ||||||
|  | ###################################################################### | ||||||
| sub ProcessMailDir($$$) { | sub ProcessMailDir($$$) { | ||||||
|   my($rfp, $inputMailDir, $outputDir) = @_; |   my($rfp, $inputMailDir, $outputDir) = @_; | ||||||
| 
 | 
 | ||||||
|  | @ -150,6 +170,7 @@ sub ProcessMailDir($$$) { | ||||||
|     closedir $mailDirFH; |     closedir $mailDirFH; | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | ###################################################################### | ||||||
| # Main Loop: | # Main Loop: | ||||||
| 
 | 
 | ||||||
| opendir(my $topDH, $INPUT_TOPLEVEL_DIR); | opendir(my $topDH, $INPUT_TOPLEVEL_DIR); | ||||||
|  | @ -167,11 +188,13 @@ while (my $rfp = readdir $topDH) { | ||||||
|       die "regular file found where we expected a type in $typeName" unless -d $typeDirName; |       die "regular file found where we expected a type in $typeName" unless -d $typeDirName; | ||||||
|       my $nativeOutputDirOneUp = File::Spec->rel2abs(catfile($OUTPUT_TOPLEVEL_DIR, 'native', $rfp, $bucketName)); |       my $nativeOutputDirOneUp = File::Spec->rel2abs(catfile($OUTPUT_TOPLEVEL_DIR, 'native', $rfp, $bucketName)); | ||||||
|       my $numberedOutputDir = File::Spec->rel2abs(catfile($OUTPUT_TOPLEVEL_DIR, 'numbered', $rfp, $bucketName, $typeName)); |       my $numberedOutputDir = File::Spec->rel2abs(catfile($OUTPUT_TOPLEVEL_DIR, 'numbered', $rfp, $bucketName, $typeName)); | ||||||
|       make_path($nativeOutputDirOneUp, {   verbose => 1,    mode => 0755 }); |       make_path($nativeOutputDirOneUp, { mode => 0755 }); | ||||||
|       make_path($numberedOutputDir, {   verbose => 1,    mode => 0755 }); |       make_path($numberedOutputDir, { mode => 0755 }); | ||||||
|       if ($typeName =~ /email/i) { |       if ($typeName =~ /email/i) { | ||||||
|         ProcessMailDir($rfp, $typeDirName, $numberedOutputDir); |         ProcessMailDir($rfp, $typeDirName, $numberedOutputDir); | ||||||
|         move($typeDirName, $nativeOutputDirOneUp); |         move($typeDirName, $nativeOutputDirOneUp); | ||||||
|  |       } else { | ||||||
|  |         ProcessDocumentDirectory($rfp, $typeDirName, $numberedOutputDir); | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|     closedir $bucketDH; |     closedir $bucketDH; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Bradley M. Kuhn
						Bradley M. Kuhn