Jump to content

Recommended Posts

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.

Link to post
Share on other sites
  • Administrators

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.

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...