QT 5.8 - how to get DIR list from FTP Server



  • Hello,
    I am using QT 5.8, and I can download single file from ftp server using with help of following classes
    QNetworkAccessManager, QNetworkRequest and QUrl.

    All this works OK, if I know which file i want to download.
    I am interested in getting dir list (e.g. *.txt) from ftp server.
    How to do that? Any help is really appreciated.

    Thanks in advance.
    DM.



  • QNetworkAccessManager cannot perform that task. You can either recompile the old QFtp Module or use an external library like libcurl



  • @dm1234

    Hi, friend, welcome devnet.

    if the Qt version less than 5.0 maybe the QFtp. will help you.

    But, QFtp has been removed from Qt. more than 5.0.

    I think, the Github Qt Ftp, Can help. Use It maybe easy.

        //......
        int setProxy(const QString &host, quint16 port);
        int connectToHost(const QString &host, quint16 port=21);
        int login(const QString &user = QString(), const QString &password = QString());
        int close();
        int setTransferMode(TransferMode mode);
        int list(const QString &dir = QString());
        int cd(const QString &dir);
        int get(const QString &file, QIODevice *dev=0, TransferType type = Binary);
        int put(const QByteArray &data, const QString &file, TransferType type = Binary);
        int put(QIODevice *dev, const QString &file, TransferType type = Binary);
        int remove(const QString &file);
        int mkdir(const QString &dir);
        int rmdir(const QString &dir);
        int rename(const QString &oldname, const QString &newname);
        //......
    


  • @joeQ

    Hello Joe,
    Thanks for your help, I already checked QFtp from git, but I wanted to use existing API in released version of QT5.8.
    I think it should be doable but don't know how to do that.

    Thanks for your help.
    DM


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.