Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Check if "System" was succesful

by nimdokk (Vicar)
on Apr 09, 2004 at 14:02 UTC ( #343910=note: print w/replies, xml ) Need Help??


in reply to Check if "System" was succesful

You could also try something like:

use File::Spec; use File::Copy; my $file=File::Spec->catfile('\\serverA','dir','subdir','file'); my $newfile=File::Spec->catfile('\\serverB','dir','subdir','file'); my $errorfile=File::Spec->catfile('\\serverA','error_dir','file'); copy $file, $newfile or warn "Unable to copy $file to $newfile. $!"; if ($? > 0) { copy $file, $errorfile; } elsif ($? == 0) { unlink $file; }

Or something along those lines, but what if you are unable to make the second copy? or what if you are unable to unlink or otherwise remove the file? I'd also recommend using File::Spec to help with the paths and directory seperators, helps make it a bit cleaner, IMO :-)

update: Fixed the tags that were borked


"Ex Libris un Peut de Tout"

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://343910]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2020-12-02 19:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you use taint mode?





    Results (45 votes). Check out past polls.

    Notices?