I have been trying to write a small application using wxwidgets(C++) that copies all the contents of the temp directory of an application and zip all the contents of the directory. I however am not able to copy the contents of the temp area completely.
Here is my code
wxString result;
result = wxFileName::GetTempDir(); //Gets the temp area.
wxFileName dir(result, wxEmptyString);
dir.AppendDir(_T("Application"));
bool a = dir.DirExists();
wxFFileOutputStream out(_T("test.zip"));
wxZipOutputStream zip(out);
wxString sep(wxFileName::GetPathSeparator());
zip.PutNextEntry(_T("entry1.txt"));
wxString temp = dir.GetLongPath();
zip.PutNextDirEntry(temp);
I am able to create test.zip and write entry1.txt and also the temp directory( without its contents). However, I dont seem to understand how to copy the subdirectories and the files in the directory.
Is there any other way to do this?
Use wxDir to enumerate the files and subdirectories of the given directory. Use wxDirTraverser or
wxDir::GetAllFiles()to do the same thing recursively.