Page 1 of 1
copy files...
Posted: Tue May 18, 2004 2:11 pm
by th3monk3y
Hi all,
I am looking for a snippet of code to copy all files from one directory to another (same server).. Probably not too hard.. just can't seem to find any examples...
-P
Posted: Tue May 18, 2004 2:16 pm
by feyd
untested stab in the darkCode: Select all
$files = glob("/path/to/source/dir/*.*");
foreach($files as $source)
{
copy($source,"/path/to/destination/".basename($source));
}
Posted: Tue May 18, 2004 2:40 pm
by th3monk3y
thanks for the quick reply feyd.. getting the following error..
Call to undefined function: glob()
-Paul
Posted: Tue May 18, 2004 3:08 pm
by th3monk3y
Apparently glob() will not work with my version of php which is 4.2.2
Posted: Tue May 18, 2004 5:32 pm
by feyd
wow, old version..
k, use
opendir() &
readdir() instead.