- Timestamp:
- Apr 4, 2012, 5:14:48 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
projects/md2mb/devel/md2mb/bin/md2mb.pl
r1445 r1446 23 23 # Is the newroot a file (1) or a dir (0) 24 24 my $nrisfile = 0; 25 # END CHANGE 25 26 my $debug = 0; 26 # END CHANGE27 27 my $help = 0; 28 28 my $man = 0; … … 30 30 # parse command-line options 31 31 GetOptions( 32 'debug|d' => \$debug, 32 33 'help|h' => \$help, 33 34 'man|m' => \$man, 34 'verbose|v' => sub { $debug++ },35 35 ) or pod2usage(2); 36 36 pod2usage(1) if ($help); 37 37 pod2usage(-exitstatus => 0, -verbose => 2) if ($man); 38 38 39 print "DEBUG MODE, not doing anything, just printing\n" if ($debug); 39 # debug mode overview 40 if ($debug) { 41 print <<EOF; 42 DEBUG MODE, not doing anything, just printing 43 --- current state --- 44 cmd = $cmd 45 oldroot = $oldroot 46 newroot = $newroot 47 --- end --- 48 EOF 49 } 50 51 # create destination path 40 52 if ($debug) { 41 53 print "TARGET DIR: mkdir -p $newroot\n" if ((not -d "$newroot") && (not $nrisfile)); … … 46 58 system("$cmd </dev/null >/dev/null 2>/dev/null") == 0 or die "cannot find formail on your \$PATH!\nTry installing procmail\nAborting"; 47 59 60 # the main work is done here 61 if ($debug) { 62 print "DESCENDING INTO oldroot($oldroot)\n"; 63 } 48 64 find(\&md2mb,($oldroot)); 49 65 66 # rename `inbox' to `Inbox' 50 67 if ((-z "$newroot/Inbox") || (! -e "$newroot/Inbox")) { 51 print "Renaming inbox into Inbox\n"; 52 move("$newroot/inbox","$newroot/Inbox") if (-e "$newroot/inbox"); 68 if ($debug) { 69 print "RENAMING inbox($newroot/inbox) INTO Inbox($newroot/Inbox)\n" if (-e "$newroot/inbox"); 70 } else { 71 print "Renaming inbox into Inbox\n"; 72 move("$newroot/inbox","$newroot/Inbox") if (-e "$newroot/inbox"); 73 } 53 74 } 54 75 … … 134 155 135 156 Options: 136 -help brief help message 137 -man full documentation 157 -debug | -d debug mode 158 -help | -h brief help message 159 -man | -m full documentation 138 160 139 161 =head1 OPTIONS 140 162 141 163 =over 4 164 165 =item B<-debug> 166 167 Enter debug mode. This will print what would be done. No commands are executed, 168 so this is safe to use when testing. 142 169 143 170 =item B<-help>
Note:
See TracChangeset
for help on using the changeset viewer.