Folders with just ONE FILE

General discussion related to "Everything".
Post Reply
pachame13
Posts: 4
Joined: Mon Mar 04, 2019 2:55 pm

Folders with just ONE FILE

Post by pachame13 » Mon Mar 04, 2019 2:59 pm

I cannot get the syntax right to find folders with JUST ONE FILE.
My ultimate goal is to find folders that contain just one file with a specific file extension (e.g. temp.txt) and NO OTHER files in that folder, so I can delete the folder safely.

vanisk
Posts: 144
Joined: Sat Oct 27, 2018 11:33 am

Re: Folders with just ONE FILE

Post by vanisk » Mon Mar 04, 2019 3:21 pm

Try this

Code: Select all

child:temp.txt childcount:1 childfilecount:1
either childcount or childfilecount on the above will work. I added both just to be sure.


Please correct me, if i'm wrong

Code: Select all

childcount:1
listing folder containing only one item (either file or directory) in it

Code: Select all

childfilecount:1
listing folder containing only one file (may be or may not be directories present along with it)

pachame13
Posts: 4
Joined: Mon Mar 04, 2019 2:55 pm

Re: Folders with just ONE FILE

Post by pachame13 » Mon Mar 04, 2019 4:24 pm

Thank you for the prompt reply! It does not seem to work, though. It points to the correct folders (temp.txt files in them) but there are other files in those folders.

therube
Posts: 2311
Joined: Thu Sep 03, 2009 6:48 pm

Re: Folders with just ONE FILE

Post by therube » Mon Mar 04, 2019 4:53 pm

Could you explain more fully what you're wanting.

vanisk
Posts: 144
Joined: Sat Oct 27, 2018 11:33 am

Re: Folders with just ONE FILE

Post by vanisk » Mon Mar 04, 2019 4:54 pm

if we put both childcount & childfilecount to 1 in a single query, it limits to only 1 sub-item and it should be file.

Did u try with both childcount & childfilecount in a single query?

child:temp.txt childcount:1 childfilecount:1

ovg
Posts: 162
Joined: Thu Oct 27, 2016 7:19 pm

Re: Folders with just ONE FILE

Post by ovg » Mon Mar 04, 2019 7:56 pm

2vanisk

For me

Code: Select all

child:temp.txt childcount:1 childfilecount:1
working like a charm!

pachame13
Posts: 4
Joined: Mon Mar 04, 2019 2:55 pm

Re: Folders with just ONE FILE

Post by pachame13 » Mon Mar 04, 2019 11:41 pm

You're right!
Let me explain what wasn´t working. When I write the full filename (temp.txt) it works as intended and is good for me, now.
But, when I tried it with *.txt (file extension txt but any filename) to catch any folder with just one file ending in .txt, regardless of the filename, it didn´t work.

vanisk
Posts: 144
Joined: Sat Oct 27, 2018 11:33 am

Re: Folders with just ONE FILE

Post by vanisk » Tue Mar 05, 2019 12:49 am

pachame13 wrote:
Mon Mar 04, 2019 11:41 pm
You're right!
Let me explain what wasn´t working. When I write the full filename (temp.txt) it works as intended and is good for me, now.
But, when I tried it with *.txt (file extension txt but any filename) to catch any folder with just one file ending in .txt, regardless of the filename, it didn´t work.
Did u happen to have any excluded file extensions or something like that?

I ran the query "child:*.txt childcount:1 childfilecount:1" on my machine and found 361 results, I manually opened all of them ( YES all the 361 :x total madness or OCD or curiosity :?: ), but found 360 folders had only 1 file (of txt extension) and ONLY 1 folder had 7 files (1 .txt file and other 6 .lnk files).

N.B: *.lnk is being excluded in my Everything settings.
2019-03-05 06_12_22-Everything.jpg

(Further, can you please tell us what other file types were included in the result. So that Admins or void could give you a solution)
You do not have the required permissions to view the files attached to this post.

void
Site Admin
Posts: 4851
Joined: Fri Oct 16, 2009 11:31 pm

Re: Folders with just ONE FILE

Post by void » Tue Mar 05, 2019 1:05 am

when I tried it with *.txt (file extension txt but any filename) to catch any folder with just one file ending in .txt, regardless of the filename, it didn´t work.
Please make sure you use child:*.txt
*.txt on its own will most likely not match any folders.

Please make sure regex is disabled from the Search menu.

pachame13
Posts: 4
Joined: Mon Mar 04, 2019 2:55 pm

Re: Folders with just ONE FILE

Post by pachame13 » Wed Mar 06, 2019 2:32 pm

Now it's completely working fine! I did as you suggested.
I cannot tell you how much your prompt and professional help meant to me. Best regards, Alberto.

Post Reply