I create an app that takes a copy of a Directory on C drive windows system to another folder when I work with windows system I give my app admin using this way here.
I use this code to copy the folder with all its content.
this function.
void MainWindow::copyPath(QString src, QString dst)
{
QDir dir(src);
if (! dir.exists())
return;
foreach (QString d, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) {
QString dst_path = dst + QDir::separator() + d;
dir.mkpath(dst_path);
copyPath(src+ QDir::separator() + d, dst_path);
}
foreach (QString f, dir.entryList(QDir::Files)) {
QFile::copy(src + QDir::separator() + f, dst + QDir::separator() + f);
}
}
and in the button
copyPath("C:/Windows/System32/spp/store", "D:/copyfolder");
when I test on another folder on D drive it worked so what I can do so that I make my qt app copy the folder from the C drive.
when I give it this path C:/Windows/System32/spp/
it copies only one folder which is C:/Windows/System32/spp/tokens
and the other folders not copied, when I give it the path C:/Windows/System32/spp/store
, it can't path this condition
QDir dir(src);
if (! dir.exists())
return;
it can't recognize directory. so please if I can do this in C# for example or any other way no problem please provide any information, as I tried with C# and it did not work too.