10 my ($startdir,$outdir,$pfx);
14 print STDERR
"usage: $0 -o <outdir> [-f <file>]\n"
19 # for the convenience of &wanted calls, including -eval statements:
20 use vars qw
/*name *dir *prune/;
21 *name
= *File
::Find
::name
;
22 *dir
= *File
::Find
::dir
;
23 *prune
= *File
::Find
::prune
;
25 if ( !getopts
('o:f:') ) {
30 if ( defined($Getopt::Std
::opt_o
) ) {
31 $outdir=$Getopt::Std
::opt_o
;
38 if ( defined($Getopt::Std
::opt_f
) ) {
39 convertfile
($outdir,$Getopt::Std
::opt_f
);
41 # Traverse desired filesystems
43 File
::Find
::find
({wanted
=> \
&wanted
}, 'source');
49 my ($dev,$ino,$mode,$nlink,$uid,$gid);
62 ($nlink || (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_))) &&
71 convertfile
($dest,$name) if $name =~ /\/$ENV{GUI
}\
//i;
75 my ($dest,$file,$destfile);
79 $dest=$startdir . "/" . $dest;
80 $file=$startdir . "/" . $file;
82 $destfile=$dest . "/" . File
::Basename
::basename
($file);
84 File
::Path
::mkpath
($dest,0,0775);
86 open(IN
,"<$file") || die "can not open $file";
87 open(OUT
,">$destfile") || die "can not open $destfile";
88 print "converting: $file -> $destfile\n" if $verbose;
90 chop while ( /\n$/ || /\r$/ );