 <p>This can do it:</p> <pre><code>$root = "serves/registered.php"; $folder = mkdir($_POST['username']); if($folder) { $reg = "registered.php"; if (!copy($root, $_POST['username']."/".$reg)) { echo "failed to copy $root...\n"; } else { echo "Account was successfuly created."; } } else { echo "Could not create folder"; } </code></pre>