0

I have a complete directory like this,

C:\server\videos\images

and this images folder may contain several images. I want to delete this images folder if there are images available in it. so how can I do that in qt5.

I've seen some of the question similar like to this.but they aren't seem to solve my problem. I don't want to delete my entire directory or an image file.I just need to delete the image folder if there are images on it.So how can I do this?

thanx in advance.!

Mlarnt90
  • 176
  • 1
  • 4
  • 19
  • possible duplicate of [Removing a non empty folder in Qt](http://stackoverflow.com/questions/11050977/removing-a-non-empty-folder-in-qt) – jpo38 Jul 30 '14 at 07:07

2 Answers2

1

Check if the directory is empty or not (contains images or not): Check if directory is empty

Then, you can remove it + its content: Removing a non empty folder in Qt

Or only its content files: Delete all files in a directory

Community
  • 1
  • 1
jpo38
  • 20,821
  • 10
  • 70
  • 151
0

If you do it like jpo38 suggested then just create that folder again after deleting. Or you just try to delete each file in the folder like mentioned here.

Community
  • 1
  • 1
John Doe
  • 146
  • 4