Page 1 of 1

how do I copy files from one dir to another?

Posted: Sat Aug 20, 2005 12:20 am
by michlcamp
I've created a small php script to create a new directory on the server, and now want to copy five files from one directory (on the same server) to the new directory and also chmod them 755.

Can anyone give me a good example for doing this? So far all I've found is:


$source_file = '/tmp/file.html';
$dest_file = '/home/mydomain/file.html';
copy($source_file, $dest_file);



thanks in advance

Posted: Sat Aug 20, 2005 3:54 am
by anjanesh
What happens when you chmod it to 766 ?

Posted: Sat Aug 20, 2005 5:01 am
by m3mn0n
Check out the function chmod() and explore around the PHP manual's filesystem section.

Keep an eye on the user notes because often they can be very helpful for beginners in a specific part of PHP scripting.