Greetings, brothers and sisters.

First of all let me humbly apologize for this question. I probably hate more asking this kind of "it's-simple-why-can't-you-see-it" question than you like answering it, but sometimes I just don't get it...

I'm developing an extremely simple app for a friend.

It's suppose to just get some files on dir1 and - if they don't exist on dir2 - copy them there.

So, here's this incredible thing:
#!/usr/bin/perl -w use strict; my $path1 = "C:\\foo\\dir1"; my $path2 = "C:\\foo\\dir2"; opendir DIR, $path1 || die "\n\nUnable to open $path1. Error: $!\n\n"; my @files = readdir DIR; closedir DIR; for (my $f = 0; $f < scalar(@files); $f++) { # test to see if it's a dir if ($files[$f] ne "." and $files[$f] ne ".." and $files[$f] !~ /\/ +/) { unless(-e "$path2\\$files[$f]") { exec("copy $path1\\$files[$f] $path2\\") || die "\n\nUnabl +e to copy $files[$f]. Error: $!\n\n"; }
Well, in dir1 I have two files: abc.xls and abd.xls When I run the app it copies only the first file (abc.xls)! If I replace the exec() line for a simple print it works perfectly...

Can someone please explain this to me?

Thanks a lot for your patience,

my ($author_nickname, $author_email) = ("DaWolf","erabbott\@terra.com.br") if ($author_name eq "Er Galvão Abbott");

In reply to Problems executing a copy command on win32 by DaWolf

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.