I have a text file that I want to copy into all sub directories which have the following structure.
S000314/0000356/data folder
/0000357/data folder
/0000358/data folder
So, I am reading all the sub directories and trying to copy the text file into all of them..But, rename function can copy only once.its copying the text file into 0000356->data folder
if ($handle = opendir('S000314')) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..")
{
rename("sdata.txt" , "/S000314/$entry/data/sdata.txt");
}
}
closedir($handle);
}
I have no clue on how to copy the same file into all of the sub directories.Please take a look at the code below.