This is a RTFM question but I'll bite anyways.
File::Copy was mentioned before.
use File::Copy;
copy("oldfile", "newfile");
So then all you need is the "dir". I noticed you are using system calls, that is unnecesary for these type of commands.
try the following
my @files = <some\\path\\here\\*>;
#the * means all files in that directory
#just in case you were confused.
finally to delete a file use the following
unlink($filename);
If you want to set the context of your perl program to read from a particular directory without having to constantly put a
$path + $filename then do the following
chdir($path) or die "foo error message\n";
#now do some foo with $filename in this directory
you just got served lol
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.