Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QT 5.8 - how to get DIR list from FTP Server
Forum Updated to NodeBB v4.3 + New Features

QT 5.8 - how to get DIR list from FTP Server

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 5 Posters 4.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dm1234
    wrote on last edited by
    #1

    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.

    joeQJ 1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

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

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      1
      • D dm1234

        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.

        joeQJ Offline
        joeQJ Offline
        joeQ
        wrote on last edited by
        #3

        @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);
            //......
        

        Just do it!

        D 1 Reply Last reply
        1
        • joeQJ joeQ

          @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);
              //......
          
          D Offline
          D Offline
          dm1234
          wrote on last edited by
          #4

          @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

          1 Reply Last reply
          0
          • P Offline
            P Offline
            Peladosok
            wrote on last edited by
            #5

            Hello everyone.
            I have to perform the same task but still can't find the solution. Does anyone have an idea how to do it without using QFtp?

            JonBJ 1 Reply Last reply
            0
            • P Peladosok

              Hello everyone.
              I have to perform the same task but still can't find the solution. Does anyone have an idea how to do it without using QFtp?

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #6

              @Peladosok
              As @VRonin said

              You can either recompile the old QFtp Module or use an external library like libcurl

              These days you're probably best using libcurl.

              There might be some sample FTP client code in Qt example https://doc.qt.io/qt-6/qtscxml-ftpclient-example.html

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved