Jalcock501 has asked for the wisdom of the Perl Monks concerning the following question:
Hey up Guys
I'm trying to write a script that searches for certain files on a CD copies them to a temp directory and then renames them and puts them in the correct directory, but the script doesn't work it copied the files to temp but then just errors.
here is my complete code. Could someone please have a look through and help as I have been stuck for ages! Thanks Guys#!/usr/bin/perl -w use strict; use File::Copy; use warning; system("clear"); system("mount /dev/cd0 /mnt"); system("cp /mnt/* /usr/castle/pctemp/."); system("umount /mnt"); my $file; my $solar = "SO_PC"; my $stdpc = "MS_PC"; my $cv = "SO_CV"; my $mb = "ms_mc"; print("\n\n\n\n\n\n\t\t\tEnter File Name:"); my $input = <STDIN>; chomp($input); $file = $input; #Solar PC if(index(uc($file), uc($solar)) != -1) { print "Copying $file to Quotes Engine"; copy($file, "PCMAP.BIN"); system("mv PCMAP.BIN /usr/castle/np_new"); } #Standard PC elsif(index(uc($file), uc($stdpc)) != -1) { print "Copying $file to Quotes Engine"; copy($file, "FULLPC.BIN"); system("mv FULLPC.BIN /usr/castle/np_new"); } # CV elsif(index(uc($file), uc($cv)) != -1) { print "Copying $file to Quotes Engine"; copy($file, "CVFULLPC.BIN"); system("mv CVFULLPC.BIN /usr/castle/np_new"); } #MB elsif(index(uc($file), uc($mb)) != -1) { print "Copying $file to Quotes Engine"; copy($file, "MBFULLPC.BIN"); system("mv MBFULLPC.BIN /usr/castle/np_new"); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Filename Partial Match function
by Eily (Monsignor) on Sep 18, 2013 at 09:09 UTC | |
Re: Filename Partial Match function
by choroba (Cardinal) on Sep 18, 2013 at 08:33 UTC | |
by Jalcock501 (Sexton) on Sep 18, 2013 at 09:20 UTC |
Back to
Seekers of Perl Wisdom