Page 1 of 1

Copying a directory tree

Posted: Tue Oct 11, 2005 7:47 am
by limonada
Hello! Does anyone have a script for copying a directory tree from one place to another? Or if somebody can give me some hints how to do it... Thanks!

Posted: Tue Oct 11, 2005 7:54 am
by Joe
You could perhaps use readdir() and loop through the files and directories.

Posted: Tue Oct 11, 2005 10:00 am
by pickle
In my experience, you don't need to worry about copying every file in the directory tree, just the directory at the top. For example, if you have a directory: /var/www/html/ and you want to copy every file in that directory, just copy that directory and each file underneath will be copied as well.

Posted: Tue Oct 11, 2005 10:05 am
by limonada
does this apply to the subdirectories too,or just the files in the directory?

Posted: Tue Oct 11, 2005 10:10 am
by pickle
Subdirectories should be copied too

Posted: Tue Oct 11, 2005 10:11 am
by limonada
ok! thanks!