title: PHP mass file copy
body: <p>If I have a file called file.html how do i make 10 clones of this file via PHP such that they are renamed file1....file10?</p>
  
  <pre><code>$filename = 'file.html'
  $copyname = 'file2.html'
  if ($file = @fopen($copyname, 'x')) {
      // We've successfully created a file, so it's ours.  We'll close
      // our handle.
      if (!@fclose($file)) {
          // There was some problem with our file handle.
          return false;
      }
  
      // Now we copy over the file we created.
      if (!@copy($filename, $copyname)) {
          // The copy failed, even though we own the file, so we'll clean
          // up by itrying to remove the file and report failure.
          unlink($copyname);
          return false;
      }
  
      return true;
  }
  </code></pre>