0

In my case files permanently are being added into the directory. I need to read names of the files which have the most recently been added into the directory, that is only new files. I'm tracking the directory using QFileSystemWatcher class. But how after that can I choose only new files with entryList or another command?

I'm able to define a special name format based on a creation time and select the necessary ones afterwards or I could differ files from each other by their modification time directly and try to use some embedded filters. But the first way is too slow and I couldn't find the appropriate filter in Qt documentation for QDir class.

Artem Zefirov
  • 423
  • 5
  • 14
  • If files cannot be renamed, you can use `QSet` to remember old files. – ilotXXI Apr 13 '17 at 16:12
  • 2
    Rather than use `QFileSystemWatcher` you might be better off using [`QFileSystemModel`](http://doc.qt.io/qt-5/qfilesystemmodel.html). Set the [root path](http://doc.qt.io/qt-5/qfilesystemmodel.html#setRootPath) to the directory of interest and listen for the various signals such as [`rowsInserted`](http://doc.qt.io/qt-5/qabstractitemmodel.html#rowsInserted) etc. – G.M. Apr 13 '17 at 17:22

0 Answers0