#!/usr/bin/perl ############################################################################# # Perl script to change '_' in QDOS file names to '.' # # ex perl;'qlmv' : use current directory # ex perl;'qlmv win2_tmp_test' : use win2_tmp_test # This script just changes the last _ to a '.', to change all the # underscores to dots, use system "mv $_ $unx" if ($unx = $_) =~ s/_/\./g; ############################################################################# chdir $dir if ($dir = shift); while (<*>) { rename($_,$unx) if ($unx = $_) =~ s/(.*)_(.*)/$1\.$2/; } ############################################################################# # And if we just wanted to rename, say _ps to .ps, then change the second # line to: ############################################################################# # while (<*_ps>) { rename ($_,$unx) if ($unx = $_) =~ s/(.*)_ps/$1\.ps/; } ############################################################################# # or maybe pass the pattern as well, as # ex perl;"qlmv win2_tmp '*.c'" ############################################################################# # ($dir,$pat) = @ARGV; # chdir $dir if $dir; # $pat = '*' unless $pat; # while (<${pat}>) {rename ($_,$unx) if ($unx = $_) =~ s/(.*)_(.*)/$1\.$2/;}