Sign in to follow this  
Followers 0
vickerps

Filecopy

3 posts in this topic

Hi guys this is a very noob question

Filecopy

Return value is 0 or 1

1=success 0=failure

If the filecopy fails i want to know about it so how query the return value

Share this post


Link to post
Share on other sites



Cheers

I have lots of files to copy to different places and I don't really want to create lot of variables and then have to write a if for each one to see if it has failed. is there any clever people out there who can suggest a better way.

I was thinking about calling a function but the some of the filecopy's are contained in other functions already which will make it calling a function from a function which sounds messy.

Share this post


Link to post
Share on other sites

The copy returns 1 so do:

$result = 0

$result = $result + FileCopy(....)

Do this for as many files as you want, and then when you want to test if they have all been successful compare $result to the number of copies.

For example if you do 10 copies and $result is 10 you know that all have succeeded. If $result does not equal 10 then one or more have failed.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0