Folders with just ONE FILE
Folders with just ONE FILE
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.
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.
Re: Folders with just ONE FILE
Try this
either childcount or childfilecount on the above will work. I added both just to be sure.
Please correct me, if i'm wrong
listing folder containing only one item (either file or directory) in it
listing folder containing only one file (may be or may not be directories present along with it)
Code: Select all
child:temp.txt childcount:1 childfilecount:1
Please correct me, if i'm wrong
Code: Select all
childcount:1
Code: Select all
childfilecount:1
Re: Folders with just ONE FILE
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.
Re: Folders with just ONE FILE
Could you explain more fully what you're wanting.
Re: Folders with just ONE FILE
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
Did u try with both childcount & childfilecount in a single query?
child:temp.txt childcount:1 childfilecount:1
Re: Folders with just ONE FILE
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.
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.
Re: Folders with just ONE FILE
Did u happen to have any excluded file extensions or something like that?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.
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 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.
(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)
Re: Folders with just ONE FILE
Please make sure you use child:*.txtwhen 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.
*.txt on its own will most likely not match any folders.
Please make sure regex is disabled from the Search menu.
Re: Folders with just ONE FILE
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.
I cannot tell you how much your prompt and professional help meant to me. Best regards, Alberto.