hello Monks,
While trying to use File::Copy I encounter a problem. The script below should copy a set of files (html, png, css, javascriptje) to a folder with the name "to_move". This is the folder that's mirrored with a folder on a server. On one of my computers (Mac iBook) the script given below runs ok. Setting up the script with exactly the same setup on a different machine (old Mac Powerbook) it runs only if I type in my terminal
./move.pl.
If I try to run it within a series of scripts like
system("perl move.pl");
it doesn't run. All my files remain in the original folder and there's no message/warning or anything. Maybe someone out there can tell me what I'm doing wrong?
Thanks,
Gert
#!/usr/bin/perl -w
#script_name = move.pl
use strict;
use diagnostics;
use File::Copy;
my $file_html = undef;
my $file_png = undef;
my $file_css = undef;
my $javascriptje=undef;
my @files_html = <*.html>;
foreach $file_html (@files_html) {
move( "$file_html", "./to_move/$file_html" ) or die "Copy html fai
+led: $!";
}
my @files_css = <*.css>;
foreach $file_css (@files_css) {
copy( "$file_css", "./to_move/$file_css" ) or die "Copy css failed
+: $!";
}
my @javascriptjes = <*.js>;
foreach $javascriptje (@javascriptjes) {
copy( "$javascriptje", "./to_move/$javascriptje" ) or die "Copy ja
+vascr failed: $!";
}
my @files_png = <*.png>;
foreach $file_png (@files_png) {
move( "$file_png", "./to_move/$file_png" ) or die "Copy png failed
+: $!";
}
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.