#
#  supplements filenames with "k-" at beginning of filename
#  writes DOS-Batch to rename file's oldname to newname
#  060329

my ( $oldname, $partname, $newname, $dirfile ) ;

$dirfile = "dir.txt" ;
$runfile="runfile";
#system( "dir /b /ong > $dirfile" ) ;
system("ls -1 > $dirfile");
open( RF, ">$runfile") or die "no $runfile\n" ;
open( DF, "<$dirfile") or die "no $dirfile\n" ;
while(<DF>) {
   chomp;
   $oldname = $_ ;
   if ( $oldname !~ /jpg/i )  { next; } 
#   $partname = $1 ;
#   print "ren \"$oldname\" \"k-$oldname\"\n"; 
   print RF "mv \"$oldname\" \"k-$oldname\"\n"; 
#   print "move /Y \"k-$oldname\" OK\n"; 
}
close $dirfile ;
#unlink $dirfile ;
close $runfile ;
#system("chmod $dirfile ug+x");
chmod 0664,$runfile ;
