Results 1 to 4 of 4

Thread: Retrieve file count in folder and subfolder

  1. #1
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Retrieve file count in folder and subfolder

    Hello,
    Can someone point me a easy/fast way to traverse through directory structure, with sub folder, and retrieve file + folder count.
    I know of QFileSystemModel but is there another way of ding it?

    Best regards

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Retrieve file count in folder and subfolder

    Have a look at QDir

  3. #3
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Retrieve file count in folder and subfolder

    I know about QDir (I struggle with this atm.), but I'm to lazy to do recursive scan of the folders (this is probably something that the programmer shouldn't say ), so I thought maybe Qt offers some convenient function that does this for me .
    And I ask because sometimes I'm amazed when I find out that qt offers function/fu8nctionality that does "thing" for me.

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Retrieve file count in folder and subfolder

    you can use QDir::entryList() (filter = QDir::Dirs or QDir::Files or...) with QList::size()

Similar Threads

  1. Save File in another Folder
    By GonzoFist in forum General Programming
    Replies: 14
    Last Post: 20th April 2010, 12:59
  2. Moving File/Folder in Qt
    By arpspatel in forum Qt Programming
    Replies: 4
    Last Post: 17th January 2010, 01:37
  3. Release folder - 1 .exe file only
    By Swankee in forum Qt Tools
    Replies: 6
    Last Post: 21st December 2009, 22:43
  4. Can't create folder if file with same name exists
    By Barry79 in forum Qt Programming
    Replies: 1
    Last Post: 6th May 2009, 16:33
  5. Retrieve public folder
    By Lele in forum Qt Programming
    Replies: 1
    Last Post: 26th July 2007, 09:48

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.