View Full Version : How-to: Replace files in directory

01-06-2006, 06:59 AM
I don't normally work at the OS file system level when using PHP and have never tried this, but I know it's gotta be possible. What I want to do is write a script that will replace files in one directory with files from another directory when invoked (even if there are already files there). Anybody ever do this? I know it would require the script to have certain permissions (this is on a Win2k3 Server). Any advice on where to get started would be appreciated!

ralph l mayo
01-06-2006, 07:07 AM
The copy() function overwrites existing files. Someone in the manual linked this recursive copying function (http://aidanlister.com/repos/?file=function.copyr.php), which looks like a good start.

01-19-2006, 07:19 AM
Ok, I've implemented a routine that will copy files like needed; however, I'm now having problems with Windows permissions.

I'm trying to use the PHP copy() function but do not know how to configure Windows permissions to get it to work correctly. Does anyone have any pointers? I don't want to create a security risk here.