34 lines
669 B
Plaintext
34 lines
669 B
Plaintext
|
#!/usr/bin/perl -w
|
||
|
|
||
|
# dodos2unix - A stupid-simple recursive dos2unix front end.
|
||
|
#
|
||
|
# This script starts recursively scanning the current working directory (.) and
|
||
|
# runs dos2unix on every text file (extensions PL, PHP, CGI, HTM, HTML, TXT,
|
||
|
# INC, and PM).
|
||
|
#
|
||
|
# --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|cml)$/i) {
|
||
|
print "dos2unix $dir/$file\n";
|
||
|
`dos2unix $dir/$file`;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
closedir (DIR);
|
||
|
}
|