Copy directory using Qt

前端 未结 7 1287
迷失自我
迷失自我 2020-12-29 05:08

I want to copy a directory from one drive to another drive. My selected directory contains many sub directories and files.

How can I implement the same using Qt?

7条回答
  •  星月不相逢
    2020-12-29 05:52

    The hard way. Copy every file individually.

    • Use QDir::entryList() to iterate over the content of a directory
    • Use QDir::cd() and QDir::cdUp() to go in and out of directories
    • Use QDir::mkdir() and QDir::mkpath() to create the new folders tree
    • and finally, use QFile::copy() to copy the actual files

提交回复
热议问题