Copy folder with QDir
-
wrote on 17 Jan 2013, 13:54 last edited by
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!) -
wrote on 17 Jan 2013, 14:35 last edited by
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
-
wrote on 17 Jan 2013, 14:44 last edited by
How can i do that, if i dont have the name of the files?
-
wrote on 17 Jan 2013, 14:47 last edited by
[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();
@ -
wrote on 17 Jan 2013, 15:21 last edited by
haha i try do this way. but i can not acess a folder shared from a other computer...
-
wrote on 17 Jan 2013, 15:27 last edited by
[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?
-
wrote on 17 Jan 2013, 15:42 last edited by
yes. and i will do try local
-
wrote on 17 Jan 2013, 21:41 last edited by
[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/8