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. Copy folder with QDir
Forum Update on Monday, May 27th 2025

Copy folder with QDir

Scheduled Pinned Locked Moved General and Desktop
8 Posts 3 Posters 12.6k 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.
  • F Offline
    F Offline
    felipe.c.sousa
    wrote on last edited by
    #1

    Hello developers!
    I was try copy a folder to my project. I think that using Qdir that is not possible. I am wrong? Somebody have other idea? thanks !
    (i dont know speak english very well, sorry!)

    From all, to all.

    1 Reply Last reply
    0
    • L Offline
      L Offline
      leon.anavi
      wrote on last edited by
      #2

      You can open the directory with "QDir":http://qt-project.org/doc/qt-5.0/qtcore/qdir.html, loop through all files and use "QFile":http://qt-project.org/doc/qt-5.0/qtcore/qfile.html method "copy":http://qt-project.org/doc/qt-5.0/qtcore/qfile.html#copy. Recursively process the sub directories.

      You can see more ideas and examples at the similar "thread":http://qt-project.org/forums/viewthread/10515

      http://anavi.org/

      1 Reply Last reply
      0
      • F Offline
        F Offline
        felipe.c.sousa
        wrote on last edited by
        #3

        How can i do that, if i dont have the name of the files?

        From all, to all.

        1 Reply Last reply
        0
        • L Offline
          L Offline
          leon.anavi
          wrote on last edited by
          #4

          [quote author="felipe.c.sousa" date="1358433843"]How can i do that, if i dont have the name of the files? [/quote]

          Use QDir. I highly recommend you to read QDir documentation :)

          @
          QDir directory("/home/mydir/");
          QStringList files = directory.entryList();
          @

          http://anavi.org/

          1 Reply Last reply
          0
          • F Offline
            F Offline
            felipe.c.sousa
            wrote on last edited by
            #5

            haha i try do this way. but i can not acess a folder shared from a other computer...

            From all, to all.

            1 Reply Last reply
            0
            • L Offline
              L Offline
              leon.anavi
              wrote on last edited by
              #6

              [quote author="felipe.c.sousa" date="1358436079"]but i can not acess a folder shared from a other computer... [/quote]

              First test your source code with directories on your local drive. After that make sure you have appropriate permission and then try to load shared directories.

              Btw you are talking about shared foldesr so you are using Windows, aren't you?

              http://anavi.org/

              1 Reply Last reply
              0
              • F Offline
                F Offline
                felipe.c.sousa
                wrote on last edited by
                #7

                yes. and i will do try local

                From all, to all.

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  DerManu
                  wrote on last edited by
                  #8

                  [quote author="felipe.c.sousa" date="1358436079"]but i can not acess a folder shared from a other computer... [/quote]
                  Then you can't copy it. That would be some security issue... Then again, Microsoft® has some capable programmers...

                  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