Query the whole folders or specified folder