Results 1 to 5 of 5

Thread: copy Files

  1. #1
    Join Date
    Sep 2014
    Posts
    94
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default copy Files

    Hi friends,


    How to copy a file from one directory to another

  2. #2
    Join Date
    Oct 2009
    Posts
    483
    Thanked 97 Times in 94 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: copy Files


  3. #3
    Join Date
    Sep 2014
    Posts
    94
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: copy Files

    it is not working...
    QFile::copy(qApp->applicationDirPath(),"E:\\projects_Qt_main\\ISRO_ SAC\\Data_Encode_Decode\\DataEncoder\\File_Receive r_Transmitter -\\Added");

    Added is the folder to copy file.....

  4. #4
    Join Date
    Sep 2011
    Location
    Bangalore
    Posts
    254
    Thanks
    92
    Thanked 16 Times in 16 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: copy Files

    The syntax is
    Qt Code:
    1. QFile::copy("/path/fileName", "/newPath/fileName");
    To copy to clipboard, switch view to plain text mode 
    Check your arguments, also check the return value.
    http://doc.qt.io/qt-4.8/qfile.html#copy-2

  5. #5
    Join Date
    Apr 2013
    Location
    Prague
    Posts
    258
    Thanks
    3
    Thanked 65 Times in 59 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: copy Files

    (1) You need to copy a file to a file. Your first argument is a directory, not a file.
    (2) Note that copy() does not overwrite. If the target file exists, nothing will be copied and you get false in return. If you need overwriting, delete the target file first.
    (3) In Qt, use forward slashes, even in windows. Therefore: "E:/projects_etc/and_so_on"

Similar Threads

  1. Replies: 1
    Last Post: 27th December 2012, 06:01
  2. Replies: 5
    Last Post: 22nd November 2012, 03:46
  3. Qt Creator Copy files at compile
    By Skinney in forum Qt Tools
    Replies: 0
    Last Post: 1st October 2010, 14:44
  4. Copy-Paste files
    By Lele in forum Qt Programming
    Replies: 11
    Last Post: 4th April 2008, 14:15
  5. Copy files+ progress
    By Fastman in forum Qt Programming
    Replies: 3
    Last Post: 22nd October 2007, 18:37

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.