Oh, yes, I see now.
That will not work because at that point the parent dir is possible not to be empty, therefore the call will fail.

Do it like I have shown you.

Another solution is:
Qt Code:
  1. void Form1::DeleteData(String dirViewPath)
  2. {
  3. ...
  4. //function body
  5. ...
  6.  
  7. if(!dirPath.count()==2) //"." and ".." -- might not be the case. if not,. test with 0
  8. {
  9. dirPath.cdUp();
  10. dirPath.rmdir(dirViewPath);
  11. }
  12. }
To copy to clipboard, switch view to plain text mode 

This will work. I forgot to mention that you have to go one level above dirViewPath, in order to delete it.

Regards