1
0
.dotfiles/home/bin/dounix2dos

30 lines
508 B
Perl
Executable File

#!/usr/bin/perl -w
# dounix2dos - Like dodos2unix except it runs unix2dos instead. See dodos2unix
#
# --Kirsle
# http://sh.kirsle.net/
use strict;
use warnings;
&scanDir (".");
sub scanDir {
my $dir = shift;
opendir (DIR, $dir);
foreach my $file (sort(grep(!/^\./, readdir(DIR)))) {
if (-d "$dir/$file") {
&scanDir ("$dir/$file");
}
else {
if ($file =~ /\.(pl|php|cgi|htm|html|txt|inc|pm)$/i) {
print "unix2dos $dir/$file\n";
`unix2dos $dir/$file`;
}
}
}
closedir (DIR);
}