Copy directory using Qt

前端 未结 7 1274
迷失自我
迷失自我 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:48

    I have made a library to manipulate files by a shell command style API. It supports a recursively copy of files and handled several more conditions.

    https://github.com/benlau/qtshell#cp

    Example

    cp("-a", ":/*", "/target"); // copy all files from qrc resource to target path recursively
    
    cp("tmp.txt", "/tmp");
    
    cp("*.txt", "/tmp");
    
    cp("/tmp/123.txt", "456.txt");
    
    cp("-va","src/*", "/tmp");
    
    cp("-a", ":resource","/target");
    

提交回复
热议问题