Reputation: 105
I am trying to copy the content of a folder which contains files. which is need to copy the to dest path from src path but while copying it is not working as per the following steps pls let me know what could the best possible ways to copy the content of the folder to another
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
qDebug() << QString("mv /home/praveen/fromTestImage/* /home/praveen/testImage/");
QString str1 = QString("cp /home/praveen/fromTestImage/* /home/praveen/testImage/");
QProcess::execute(str1);
}
Error :
cannot stat `/home/praveen/fromTestImage/*': No such file or directory
Thanks for your time !! Praveen
Upvotes: 1
Views: 1109
Reputation: 243955
Wildcards like the asterisk(*)
are not part of the cp
command but the bash system so the executable cp
will not recognize it, we can perform the same task without using that wildcard as shown in the following example:
QStringList args = QStringList()<<"-r" <<
"/home/praveen/fromTestImage/."<<
"/home/praveen/testImage/";
QProcess::execute("cp", args);
The solution was based on the following response
Upvotes: 2