Jalcock501 has asked for the wisdom of the Perl Monks concerning the following question:
i.e
Fileblah -> tempdir -> Rename -> finaldirThe question is how do I get rid of the user input so that they just run the script automatically and it can check for the correct file.
Here is my code so farThe files always come in as one of the four#!/usr/bin/perl -w use strict; use File::Copy; use warning; my $np_new = 'usr/castle/np_new/' my $temp = 'usr/castle/pctemp' system("clear"); system("mount /dev/cd0 /mnt"); system("cp /mnt/* $temp/."); system("umount /mnt"); my %dest = (SO_PC => 'PCMAP.BIN', MS_PC => 'FULLPC.BIN', SO_CV => 'CVFULLPC.BIN', MS_MC => 'MBFULLPC.BIN'); print "\n" x 5, "\t" x 3, "Input required: "; chomp $fileName; my $fileName = <STDIN>; for my $search (keys %dest) { die "$fileName does not exist!" unless -e $fileName; copy ($fileName, $np_new.'/usr/castle/pctemp/'$dest{$search}) if $f +ileName =~ /^$search/i; }
SO_PC(refnum).BIN
MS_PC(refnum).BINSO_CV(refnum).BIN
MS_MC(refnum).BIN
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Read, Load and rename files on CD
by Anonymous Monk on Oct 16, 2013 at 10:44 UTC | |
|
Re: Read, Load and rename files from CD
by kcott (Archbishop) on Oct 17, 2013 at 03:23 UTC | |
|
Re: Read, Load and rename files from CD
by pvaldes (Chaplain) on Oct 16, 2013 at 13:52 UTC | |
|
Re: Read, Load and rename files from CD
by GotToBTru (Prior) on Oct 16, 2013 at 17:04 UTC |