This script moves file from my computer to a mapped
drive
k:/. when it runs it will move the first file
but skips over the rest of the files is there a reason for this
I also need to know how to fix it too
#
#
# moves the ATM files from the c: to c:\atm and renames them with t
+he
# current date.
#
#
use File::Copy;
@files = ("ATMCAF00", "ATMCAF01", "ATMCAF12", "ATMCMF01", "ATMCMF12");
$old = "c:/";
$new = "K:/ATM/";
print "Enter the month and day (ex:0605)\n";
$date = <stdin>;
chomp($date);
sub moving {
print "Moving $_ to the K:/ATM \n";
move("$old$_","$new$_$date");
print "$_ has been moved to the K:/ATM\n";
print "---------------------------------------------\n";
}
foreach (@files) {
&moving;
}
print "All the ATM files have been renamed and move to the ATM folder\
+n";
$wait = <stdin>;
This is what i had at the beginning, at first it worked
because i was just moveing the files to another
folder on the c:, but when i start moveing
the files to a mapped drive all this started up so I tried
to rewrite it.
print "Enter the month and day (ex:0605)\n";
$date = <stdin>;
chomp($date);
move(c:/atmcaf00,K:/atm/atmcaf00$date);
move(c:/atmcaf00,K:/atm/atmcaf01$date);
move(c:/atmcaf00,K:/atm/atmcaf12$date);
move(c:/atmcaf00,K:/atm/atmcmf01$date);
move(c:/atmcaf00,K:/atm/atmcmf12$date);
print "All the ATM files have been renamed and move to the ATM folder\
+n";
$wait = <stdin>;
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.