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. how to transfer files from raspberry pi to External USB Drive?

how to transfer files from raspberry pi to External USB Drive?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 277 Views 2 Watching
  • 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.
  • Ramkumar MohanR Offline
    Ramkumar MohanR Offline
    Ramkumar Mohan
    wrote on last edited by
    #1

    how to transfer files from raspberry pi to External USB Drive?
    c++ code :-

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      QFile::copy.

      One hint: search the Qt documentation, there's quite a lot of stuff in there.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      Ramkumar MohanR 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        QFile::copy.

        One hint: search the Qt documentation, there's quite a lot of stuff in there.

        Ramkumar MohanR Offline
        Ramkumar MohanR Offline
        Ramkumar Mohan
        wrote on last edited by
        #3

        @SGaist
        Hi,

        bool copyFiles() {
        const QString srcPath = QFileDialog::getOpenFileName(this, "Source file", "",
        "All files (.)");
        if (srcPath.isNull()) return false; // QFileDialog dialogs return null if user canceled

        const QString dstPath = QFileDialog::getSaveFileName(this, "Destination file", "",
        "All files (.)"); // it asks the user for overwriting existing files
        if (dstPath.isNull()) return false;

        if (QFile::exist(dstPath))
        if (!QFile::remove(dstPath)) return false; // couldn't delete file
        // probably write-protected or insufficient privileges

        return QFile::copy(srcPath, dstPath);
        }

        These codes work well. Thanks

        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