Results 1 to 4 of 4

Thread: copy directories recusively

  1. #1
    Join Date
    Dec 2009
    Posts
    22
    Thanks
    3
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default copy directories recusively

    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.

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: copy directories recusively

    Here you have a ready function. Efficient Googling is an art

  3. The following user says thank you to Lesiok for this useful post:

    knobby67 (3rd August 2014)

  4. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: copy directories recusively

    Quote Originally Posted by knobby67 View Post
    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,
    _

  5. #4
    Join Date
    Dec 2009
    Posts
    22
    Thanks
    3
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: copy directories recusively

    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

Similar Threads

  1. Meaning of ':' in Qt directories
    By mchome in forum Newbie
    Replies: 1
    Last Post: 11th August 2012, 21:43
  2. QSettings: copy from ini to xml? Copy group?
    By TorAn in forum Qt Programming
    Replies: 1
    Last Post: 11th January 2012, 14:51
  3. Return number of directories in a directories
    By franco.amato in forum Newbie
    Replies: 7
    Last Post: 29th September 2010, 23:29
  4. Copy Directory Recusively
    By hkothari in forum Qt Programming
    Replies: 4
    Last Post: 22nd August 2009, 12:43
  5. How to create directories??
    By paranoid_android in forum Qt Programming
    Replies: 3
    Last Post: 9th March 2006, 16:28

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.