Mlarnt90
Mlarnt90

Reputation: 186

how to remove a sub directory in qt5

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.!

Upvotes: 0

Views: 403

Answers (2)

jpo38
jpo38

Reputation: 21544

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

Upvotes: 1

John Doe
John Doe

Reputation: 146

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.

Upvotes: 0

Related Questions