Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Created by @Pytlicek and Milan Huska
- <?php
- # Date Function for Logging
- $today = date("Y-m-d H:i:s");
- # Open or Create Log File
- $myfile = fopen("/home/hosting_user/www_root/log.html", "a") or die("Unable to open file!");
- # Create array of file paths
- $file_paths = array('/home/hosting_user/somefolder/1/1_xml.zip','/home/hosting_user/somefolder/2/1_xml.zip');
- # Copy file from source to destination file path / paths (from array)
- foreach ($file_paths as &$value) {
- # Source File Path
- $source_file = '/home/hosting_user/source_folder/1_xml.zip';
- # Copy File from source to destination : as $value in current loop
- copy($source_file, $value);
- # Optional : Print status if it is successfully created
- echo "OK File : " . $value . "<br />";
- # Define text to Log and write it to LogFile
- $txt = $today . " OK File : " . $value . "\n";
- fwrite($myfile, $txt);
- }
- # Close File after processing
- fclose($myfile);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement