I’m writing a script that will grab several files and then copy them into a new directory. I’ve come up with two methods of doing this but want to know which is better.
1)
- store several file names in an array and use file_get_contents in a loop to get those files.
- same again, but using file_put_contents to copy these files to a new directory.
2)
- Store these files needed in a .ZIP file by default
- Use PHP to open this zip and extract the contents to the new folder.
I’m guessing that the ZIP method is better to use but I have no evidence to back that up. Can anyone advise me on what’s best?
Store the files to copy in an array and use PHP’s copy() function to copy the files to the desired directory.