Please use more descriptive sibjects!

On Tuesday 18 April 2006 11:47, Irfan J Sayed wrote:
>  my $cp = dircopy("D:\\vobs","D:\\backup");
>  if ($cp == 0)

unless($cp) # this will execute the first block if $cp is empty

>  {
>   print " Copied successfuly\n";
>  }
>  else
>  {
>   print " Copying failed\n";
> }
>
> But in variable $cp proper value is not coming .Either it should come as 0
> or1 but it's coming as any junk value or no.

dircopy($FROM_DIR,$TO_DIR) or die("Copying failed"); # should also work

If you read the manual for dircopy you will see that it doesn't return a 
"successfull/unsuccesfull" boolean, but a list:
my($num_of_files_and_dirs,$num_of_dirs,$depth_traversed) = dircopy($orig,
$new);

So the "junk" value you are refering to is the number of files and dirs 
copied. If it fails it probably returns a undef value.

-- 
Bjørge Solli - Office:+47 55205847 http://www.nersc.no
Nansen Environmental and Remote Sensing Center - Bergen, Norway
Dept.: Mohn-Sverdrup Center for Global Ocean Studies 
       and Operational Oceanography

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to