Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QDirIterator not working with flags ;/



  • Hey
    I can't get it to work, what's wrong >

    it = QDirIterator(dirPath, QDir.NoDotAndDotDot, QDirIterator.Subdirectories)
    

    Dat gives me empty stuff

    Regards
    Dariusz

    I also cant get this to print anything>

    it = QDirIterator(dirPath, ["*.exr"], filters=QDir.NoDotAndDotDot, flags=QDirIterator.NoIteratorFlags)
    


  • @Dariusz your question is unclear



  • the result is empty, if I remove NoDotAndDotDot I get result. So for some reason asking it to remove /. and /.. cause it to return empty.



  • @Dariusz Filters are flags so if you want to get directories and not dotanddots then use:

    it = QDirIterator(
        dirPath, QDir.Dirs | QDir.NoDotAndDotDot, flags=QDirIterator.Subdirectories
    )
    

    If you want files:

    it = QDirIterator(
        dirPath, QDir.Files | QDir.NoDotAndDotDot, flags=QDirIterator.Subdirectories
    )
    

    Same:

    it = QDirIterator(
        dirPath, ["*.exr"], filters=QDir.Files | QDir.NoDotAndDotDot, flags=QDirIterator.NoIteratorFlags
    )
    

Log in to reply