Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. What is the API to search for a folder/directory without iterating all children
Forum Updated to NodeBB v4.3 + New Features

What is the API to search for a folder/directory without iterating all children

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 953 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    av2306
    wrote on last edited by
    #1

    Hi,

    I want to search for a directory under given path on Linux. But, I don't want to iterate all folders and compare directory for each iterator.

    Is there any smart way to find the folder with Qt? (I expect, like spotlight apis on mac)

    Thanks.

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      If you mean a search query that calls you back on find then there's no such thing in Qt, but you can easily construct such a class. Call QDir::entryList for a base directory and use contains() on the resulted list. If it's there emit a signal. If not recursively call it on each sub-directory. Shouldn't be much of a hassle.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        av2306
        wrote on last edited by
        #3

        Thank you.

        If desired directory is leaf node and tree has so much depth on linux file system, then it would give performance issue. If already indexed for file system, then it's easy to find the entry from database. It shouldn't take long time to find directory. I have find directory in button click event. Any solution?

        1 Reply Last reply
        0
        • Chris KawaC Offline
          Chris KawaC Offline
          Chris Kawa
          Lifetime Qt Champion
          wrote on last edited by
          #4

          I'm not a linux guy so I won't be of much help, but if all else fails you can always QProcess whatever linux command you think will be the fastest.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved