Results 1 to 10 of 10

Thread: QFile::exists( filename ) slow

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2006
    Posts
    426
    Thanks
    8
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QFile::exists( filename ) slow

    Hello, I have about 3,000,000 small files in a directory tree that needs to be ftped through network.

    I use QNetworkAccessManager to handle the job. About 1,000,000 files have been ftped to another computers, so I tar those files and untar into the target computer, and I do
    Qt Code:
    1. foreach( filename, fileList ) {
    2.  
    3. if ( !QFile::exists( filename ) ) {
    4.  
    5. // start ftp filename using QNetworkAccessManager.
    6.  
    7. }
    8.  
    9.  
    10. }
    To copy to clipboard, switch view to plain text mode 

    However, QFile::exists( filename ) takes a lot of time (about 0.02 second ) per file. If I kills the program and restart it, those files that have been checked by QFile::exists( filename ) will return quickly ( 0.001 seconds ), that is 20 times faster.

    How can I solve this problem?

    Thanks.
    Last edited by lni; 23rd February 2015 at 16:31.

Similar Threads

  1. Replies: 3
    Last Post: 19th September 2014, 07:23
  2. Replies: 2
    Last Post: 6th May 2013, 08:06
  3. Replies: 4
    Last Post: 9th May 2011, 09:52
  4. Replies: 2
    Last Post: 21st February 2011, 14:52
  5. Replies: 3
    Last Post: 28th March 2009, 15:37

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.