Results 1 to 6 of 6

Thread: how to list out all files in a dir and sub dir

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2006
    Location
    Bangalore,India
    Posts
    235
    Thanks
    7
    Thanked 25 Times in 24 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Question how to list out all files in a dir and sub dir

    Hi!
    I have written following code to find all files in given directories, but the following code does not give the list of all files available in sub directory too.
    How to get all file names?
    And how to filter only specific extension files eg: only .txt file ?

    Qt Code:
    1. QDir dir(wsPath);
    2. dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
    3. QFileInfoList list = dir.entryInfoList();
    4. for (int i = 0; i < list.size(); ++i)
    5. {
    6. if(list.at(i).completeSuffix() == "txt" )
    7. {
    8.  
    9. }
    10. }
    To copy to clipboard, switch view to plain text mode 

    Regards
    Rajesh
    Last edited by jacek; 14th August 2006 at 11:32. Reason: changed [ html ] tags to [ code ] tags

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.