Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Move directory using Qt

Tags:

directory

qt

move

I want to move a directory. My selected directory contains many sub directories and files.

How can I implement the same using Qt?

like image 770
Бориска Сосиска Avatar asked Oct 24 '12 08:10

Бориска Сосиска


1 Answers

QDir::rename does it in the most cases. Following example moves theDir incl content from source to dest:

QString original = "/home/test/source/theDir";
QString dest = "/home/test/temp";
QDir dir;
if( !dir.rename( original, dest ) ){
  throw Exception( "move failed" );
}
like image 84
Reto ODT Avatar answered Oct 16 '22 19:10

Reto ODT