Results 1 to 5 of 5

Thread: QFileInfo and lastModified for directory

  1. #1
    Join Date
    Jul 2008
    Location
    East Coast, USA
    Posts
    40
    Thanks
    6
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Question QFileInfo and lastModified for directory

    Hi,

    I'm getting a list of subdirectories and files of a super-directory. I'm then checking for when one of the sub-directories was last modified.

    My .lastModified() call to the QFileInfo runs but only gives me the correct information when its a file. When its a directory I get the creation date. If I check the properties of the directory in finder (I'm on Mac OS X) the directory is shown correctly to have been modified if, say a file is moved into it.

    How do I get the last modified time for a directory?

    Thanks!
    -Kaushik

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QFileInfo and lastModified for directory

    You may write your own criteria for it.
    As far as I understand Directory isnt a file actually, so 'modify' property will depend on the sub folders and files in it.
    Hope am making sense

  3. #3
    Join Date
    Jul 2008
    Location
    East Coast, USA
    Posts
    40
    Thanks
    6
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: QFileInfo and lastModified for directory

    Hi aamer4yu,

    Thanks for your reply.

    I understand that the directory modify property depends on the children. I want this behavior. However, when I read the lastModified property it does NOT reflect this property. I was wondering what property of QFileInfo I need to access to get this.

    Thanks
    -K

  4. #4
    Join Date
    Jul 2008
    Location
    East Coast, USA
    Posts
    40
    Thanks
    6
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: QFileInfo and lastModified for directory

    Not to be annoying, but BUMP -K

  5. #5
    Join Date
    Jul 2008
    Location
    East Coast, USA
    Posts
    40
    Thanks
    6
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Thumbs up Re: QFileInfo and lastModified for directory

    Hmm, I didn't understand 'touch'. Touching a file will alter its modified date BUT will not affect the super-directory, so QT is doing just fine, I was mistaken.

Tags for this Thread

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.