There doesn't seem to be any recursion in your code, not even any hint of listing a directory on the server and processing its files.
Cheers,
_
There doesn't seem to be any recursion in your code, not even any hint of listing a directory on the server and processing its files.
Cheers,
_
No its not,i my code i am just able to copy selected file only ,but there suppose to be lots of file there so its pain to select and copy each file individually. so i just want to copy whole directory.
I hope my point is clear to you.
Thanks for your time and consideration.
And here is my get function code
int QFtp::get(const QString &file, QIODevice *dev, TransferType type)
{
QStringList cmds;
if (type == Binary)
cmds << QLatin1String("TYPE I\r\n");
else
cmds << QLatin1String("TYPE A\r\n");
cmds << QLatin1String("SIZE ") + file + QLatin1String("\r\n");
cmds << QLatin1String(d->transferMode == Passive ? "PASV\r\n" : "PORT\r\n");
cmds << QLatin1String("RETR ") + file + QLatin1String("\r\n");
return d->addCommand(new QFtpCommand(Get, cmds, dev));
}
void FtpWindow::downloadFile()
{
progressDialog->setVisible(true);
//progressDialog = new QProgressDialog(this);
///************test ***
// QFileInfoList
QString fileName = fileList->currentItem()->text(0);
qDebug()<<"File name is :"<<fileName;
if (QFile::exists(fileName)) {
QMessageBox::information(this, tr("FTP"),
tr("There already exists a file called %1 in "
"the current directory.")
.arg(fileName));
return;
}
file = new QFile(fileName);
if (!file->open(QIODevice::WriteOnly)) {
QMessageBox::information(this, tr("FTP"),
tr("Unable to save the file %1: %2.")
.arg(fileName).arg(file->errorString()));
delete file;
return;
}
ftp->get(fileList->currentItem()->text(0), file);
progressDialog->setLabelText(tr("Downloading %1...").arg(fileName));
downloadButton->setEnabled(false);
progressDialog->exec();
}
Bookmarks