Move directory using Qt

directory, move, qt

Solution

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" );
}

Problem

I want to move a directory. My selected directory contains many sub directories and files. How can I implement the same using Qt?

Original source