How to find Empty Folders with conditions attached ?

If you are experiencing problems with "Everything", post here for assistance.
Post Reply
Flourgrader
Posts: 94
Joined: Fri May 28, 2021 7:55 am

How to find Empty Folders with conditions attached ?

Post by Flourgrader »

Hi Everyone,
A belated Happy New year to All.
I would like to ask a question on finding Folders that are Empty, and deleting them?
I have done some reading on here, but not found what I wanted.
I am using "Everything 1.5.0.1295a(64)"
I am cleaning up A 10TB drive. Some of the data is rubbish and some is very important. I have been using the filter in everything to pull all the data together to do a mass delete. But I have been left with a lot of empty folders or with unwanted files in them but I wish to consider them as empty.
As an example, any folder containing the files below I would like them to be ignored and the folder to be classed as empty.
*.tmp
Desktop.ini
Thumbs.db
Could someone give me an example the syntax of how this could be done.
Empty: ????

Thank You..
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: How to find Empty Folders with conditions attached ?

Post by NotNull »

I think I'm overlooking a straightforward solution, but the first thing that comes to mind is the following:

Code: Select all

"C:\start folder\"  childfoldercount:0    !regex:child:"^(?!desktop\.ini$)(?!thumbs\.db$)(?!.*\.tmp$)"
Breakdown:

"C:\start folder\"
= The folder you want to inspect and all it's subfolders.
childfoldercount:0
= Report folders that have no subfolders
regex:child:"^(?!desktop.ini$)(?!thumbs.db$)(?!.*\.tmp$)"
= regular expression search for folders that contain files that do NOT match tyhe text desktop.ini, thumbs.db and *.tmp


Note:
- MAke sure to check your Exclusions (Menu:Tools > Options > Indexes > Exclude as well as the Include Only settings of the NTFS disk(s)) because if Everything is not aware of the existence of a file, it might report a folder as empty when it is not.
- Some characters have special meaning in regular expressions ( \ ^ ( ) { } [ ] + . $ ) . If the filenames you need to specify contain those characters, please post them so we can change the query accordingly.

This will also report empty folders as those match the regex too (no files other than a possible desktop.in, thumbs.db or *.tmp)


EDIT:
Just ralized that I made a typo. Fixed.
void
Developer
Posts: 16751
Joined: Fri Oct 16, 2009 11:31 pm

Re: How to find Empty Folders with conditions attached ?

Post by void »

Happy New Year!

The safest approach to do this would be to create a file list excluding *.tmp, desktop.ini, thumbs.db, opening this file list and searching for empty:
  • In Everything, search for the following:
    !*.tmp !Desktop.ini !Thumbs.db
  • From the File menu, click Export....
  • Change Save as type to EFU Everything File List.
  • Choose a filename (eg: empty.efu) and click Save.
  • From the File menu, click Open File List....
  • Select your empty.efu from above and click OK.
  • Search for:
    empty:
  • When you are finished with the results, close the file list:
  • From the File menu, click Close File List.

Use Alt + Enter (Properties) to double check the folders are empty before deleting.
Flourgrader
Posts: 94
Joined: Fri May 28, 2021 7:55 am

Re: How to find Empty Folders with conditions attached ?

Post by Flourgrader »

Thank You NotNull & David,
for your answers, they where much appreciated.

Maybe I could make a suggest as an option to add such a function
to everything on the menu in Search in future updates to version 1.5
Plus maybe change the colour of Empty folders to Red
to signify the folders are empty?
void
Developer
Posts: 16751
Joined: Fri Oct 16, 2009 11:31 pm

Re: How to find Empty Folders with conditions attached ?

Post by void »

Thanks for your reply.
Maybe I could make a suggest as an option to add such a function
to everything on the menu in Search in future updates to version 1.5
This will most likely happen in beta.
For now, please subscribe to the Everything 1.5 Alpha topic (login, click the wrench 🔧 at the bottom-left and click subscribe topic).
Plus maybe change the colour of Empty folders to Red
to signify the folders are empty?
conditional colors are on my TODO list.
Thank you for the suggestion.
Flourgrader
Posts: 94
Joined: Fri May 28, 2021 7:55 am

Re: How to find Empty Folders with conditions attached ?

Post by Flourgrader »

Thank You.
That's music to my ears,
I am a big fan of coloured Folders.
Flourgrader
Posts: 94
Joined: Fri May 28, 2021 7:55 am

Re: How to find Empty Folders with conditions attached ?

Post by Flourgrader »

Thank you for the links,therube.
I read some of your links before posting.
I use this alongside Everything 1.5
https://www.jonasjohn.de/red.htm
it’s a nice program, I would like to see similar
option inside Everything 1.5
raccoon
Posts: 1017
Joined: Thu Oct 18, 2018 1:24 am

Re: How to find Empty Folders with conditions attached ?

Post by raccoon »

I don't think this was explicitly mentioned, but a couple other handy tools.

childcount:0 <-- will show you all empty folders
(edit:) empty: <-- same thing (referenced in 'Empty folders are really empty?' post above.)

folder:size:0 <-- will show you all zero-byte folders (if you have "[x]Index folder size" enabled.)

If you go through searching for files like thumbs.db, desktop.ini, *.tmp, and delete them all, you can then use the above searches to find folders that are now empty since those files were deleted.
Flourgrader
Posts: 94
Joined: Fri May 28, 2021 7:55 am

Re: How to find Empty Folders with conditions attached ?

Post by Flourgrader »

Thanks, for your info: raccoon.
Funnily enough I was just reading up on
childcount:0
folder:size:
I am educating myself on the syntax used in Everything 1.5. :idea:
As I am still a novice with this software. :lol:
raccoon
Posts: 1017
Joined: Thu Oct 18, 2018 1:24 am

Re: How to find Empty Folders with conditions attached ?

Post by raccoon »

as a pointer, not all touching syntax is necessarily required to be touching, but just aesthetically pleasing, while other syntax must be touching-combos.

folder:size:0 is the same as folder: size:0 and size:0 folder:, as both terms assert themselves independently.
Post Reply