Jump to content

[SOLVED] Theory question writting over a directory


koolaid

Recommended Posts

I am building an mp3 player CMS. I have everything working, but to make my cms more functional i would like to have all the data write to a temporary folder. Then before going live to the public the user can view what the finished page will look like. When the user hits save the temporary folder will write over the currently live folder. Is this possible? Could anyone point me in the direction of a good tutorial for this. Or does anyone have a snippet i can modify?

 

Thanks freaks

The best way to do this, from my perspective, would be to delete the existing directory and rename the temp directory.

 

The 2nd post on this PHP manual page has a function to delete an entire directory that has contents.

http://us.php.net/manual/en/function.unlink.php

 

Then rename using this command: http://us.php.net/rename

Awesome i wasn't sure the best practice there. I didn't even think of deleting the live directory first. I will give that a shot. Just wondering, but would there be issues trying to write over a directory by naming a folder the same name as an existing folder? (just curious)

Awesome i wasn't sure the best practice there. I didn't even think of deleting the live directory first. I will give that a shot. Just wondering, but would there be issues trying to write over a directory by naming a folder the same name as an existing folder? (just curious)

 

I'm not sure. You could also just copy the contents of the temp directory to the existing directory.

 

But, both of those methods have a flaw. If you have any file in the existing directory that does not exist in the temp directory, then copying or overwriting will not remove those unneeded files.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.