Results 1 to 4 of 4

Thread: Difference a file and a directory

  1. #1
    Join Date
    Jul 2006
    Posts
    126
    Thanks
    17
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Difference a file and a directory

    Hi,

    I'm doing a recursive function to load a list of files of a directory, how can I know if a item is a file or a directory?

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Difference a file and a directory

    Everything is a file.

    QFileInfo::isDir() & Co.

  3. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Difference a file and a directory

    Quote Originally Posted by xgoan
    I'm doing a recursive function to load a list of files of a directory, how can I know if a item is a file or a directory?
    Presumably you are using QDir::entryList()?
    Try using QDir::entryInfoList() instead and then QFileInfo::isDir(), QFileInfo::isFile()...
    J-P Nurmi

  4. #4
    Join Date
    Jul 2006
    Posts
    126
    Thanks
    17
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Difference a file and a directory

    Hehehe Thanks

Similar Threads

  1. QApplication: no such file or directory
    By jochen_r in forum Newbie
    Replies: 13
    Last Post: 15th November 2008, 21:46
  2. Replies: 4
    Last Post: 24th February 2006, 10:30
  3. lqtmaind - no such file or directory
    By krivenok in forum Qt Programming
    Replies: 2
    Last Post: 21st February 2006, 18:05
  4. create file in another directory
    By raphaelf in forum Qt Programming
    Replies: 3
    Last Post: 16th February 2006, 10:04
  5. Am I the only one with "make" error ?
    By probine in forum Installation and Deployment
    Replies: 1
    Last Post: 13th February 2006, 12:54

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.