Hi im try to copy a directory and all its contents. I thought a good start is to list all the sub directories so i can get an idea and copy the sub structure to my destination folder.
but i need to get the path from the QDir onwards not the path from the root of the machine, how do i do this so i get sweetassurfwear/folder/folder instaed of /usr/local/websites/sweetassurfwear/folder/folder
here is my code so far
QDir targetDir1("/home/brett/sweetback");
targetDir1.mkdir("sweetassurfwear");
QDir targetDir("/usr/local/websites/sweetassurfwear");
targetDir.setFilter(QDir::NoDotAndDotDot| QDir::Dirs | QDir::Files);
QDirIterator it(targetDir, QDirIterator::Subdirectories);
while (it.hasNext()) {
QFileInfo Info(it.next().relativePath());
QString testName = QString(Info.fileName());
QString testPath = QString(Info.absoluteFilePath());
if(Info.isDir()){
// QString cpd = "/home/brett/sweetback/sweetassurfwear/";
// targetDir.mkdir(cpd+testName);
QString dirname = Info.filePath();
ui.textEdit->append(QString("Copy Files " + dirname));
}
}