Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to create a backup script that gets all the contents of two specific directories, and retains their structure. So for example I have one directory /images/ and another one /neou_cms/images/users. The zip should only include the files inside these directories, and retain their structure so I can "restore" by unzipping at the root. I have seen similar techniques for one directory, as well as for the entire site, but since the only files that would be changed on my site are located in these two directories I do not see the benefit of wasting 100mb or more on a zip file. Does anyone know (specifically) how I can accomplish this?

share

migration rejected from stackoverflow.com Jul 11 '13 at 3:46

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as off-topic by Sathya Jul 11 '13 at 3:46

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question is not about computer hardware or software, within the scope defined in the help center." – Sathya
If this question can be reworded to fit the rules in the help center, please edit the question.

    
With exec() and a command like zip -r backup.zip images/ dir2/, or using ZipArchive::addFile() after traversing the directories and building a file list yourself. –  mario Jul 9 '13 at 0:12