PDA

View Full Version : copy directories recusively



knobby67
2nd August 2014, 17:36
Hi All,
in my C++ linux code I would use something like system("cp -R /from /to"); to copy over a directory tree. Can I do this with QT code? I've been reading QDir but can't see a way to do it. I might be missing something...
I've Googled this but all the answers I see seem to use long winded functions with recursive copies of files.
Thanks in advance.

Lesiok
2nd August 2014, 17:56
Here (https://gist.github.com/ssendeavour/7324701) you have a ready function. Efficient Googling is an art :D

anda_skoa
3rd August 2014, 09:54
in my C++ linux code I would use something like system("cp -R /from /to"); to copy over a directory tree. Can I do this with QT code?

Qt code is C++ code.
But obviously any code depending on system tools is usually not very portable.

Cheers,
_

knobby67
3rd August 2014, 10:49
Thanks All,
I thought QT would have some sort of QDir::copy function.

PS I know QT is C++, but I'm trying :s to learn QT so want to do things using it's commands or else I'd end up with C++ code on a QT IDE :D