Now, you could easily add a simple message box or something in a GUI application to confirm the deletion, which would be more sensible if you are scanning a small tree of files. If we do, a simple boolean is flagged to destroy the file and we remove it. We iterate over these until we find a match with one of these types. We also have a QStringList of all the file types you don’t want, i.e. Literally, you can get a QFileInfo instance for the file/dir, which can be very useful to subsidize the code if you are just looking for something like, say, executables. I won’t go into the specifics now, as this is a quick tip, but let me go over the algorithm really quick before we get to the code.īasically, we use a QDirIterator to scan through all directories and files. I’ve been working on application lately that needs to recursively scan through directories and delete files that could potentially cause harm to someone’s computer.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |