Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[SOLVED] Possible to upload a QDir with QFtp
Woody last edited by
Ok what I have atm is that i can check for changed file (date modified, content modified).
The files that are changed, will be uploaded to the server.
This all works fine, connects nice, logs me in, etc.
But now my question is, if it is possible to upload a whole directory?
So if I add a directory to my folder I'm checking, I don't have to bother about are the files changed.
Somebody knows more about this?
Thanks in advance!
rcari last edited by
You will have to implement that yourself, FTP is a File Transfer Protocol, when GUI application seem to transfer a folder, they really do the work of uploading each file separately in the background.
Woody last edited by
Well I've found the solution for that problem. But it was quiet complicated.
I go check my whole folder (local one) and add all the folders to a list:
QFileInfoList fileListRoot(QDir(rootPath).entryInfoList(QDir::NoDotAndDotDot | QDir::Dirs, QDir::Time | QDir::Reversed));
foreach(QFileInfo fileInfo, fileListRoot)
Then I compare the folder with the online list, which I fill up with this:
@void FtpThread::ftpListInfo(QUrlInfo urlInfo)
if(!m_folderList.contains((m_folder == "" ? "" : m_folder + "/") + urlInfo.name()))
m_folderList << (m_folder == "" ? "" : m_folder + "/") + urlInfo.name();
And if the folder doesn't exist, I just make it:
@foreach(QFileInfo folderInfo, folderList)
QString folder = folderInfo.filePath().right(folderInfo.filePath().length() - (getLocalDir().length() + 1));
if(!m_folderList.contains(folder) && !m_creatingBusy)
m_folder = folderInfo.filePath().right(folderInfo.filePath().length() - (getLocalDir().length() + 1));
if(folder.lastIndexOf("/") > -1)
m_folder = m_folder.left(m_folder.length() - (folder.length() - folder.lastIndexOf("/")));
m_folder = "";
So everytime something changed on the server, I go check if it is a directory. It's quiet complicated and hard to explain, but I got it working.
Thanks though for the reply.