Say I\'ve got a file test.php in foo directory as well as bar. How can I replace bar/test.php with foo/test.php
test.php
foo
bar
bar/test.php
foo/test.php
copy will do this. Please check the php-manual. Simple Google search should answer your last two questions ;)