How to find empty files?

If you are experiencing problems with "Everything", post here for assistance.
Post Reply
voidme
Posts: 12
Joined: Sun Sep 27, 2020 9:54 pm

How to find empty files?

Post by voidme »

For example: this command does not find files which start with zero's:
startwith:hex:binary:content:000000000000000000000000000000000000000000000000
It should search in all files which content is not indexed.
For now, I assume if the file starts with 000000000000000000000000000000000000000000000000, the file is empty.
void
Developer
Posts: 16770
Joined: Fri Oct 16, 2009 11:31 pm

Re: How to find empty files?

Post by void »

Use the fromdisk: search modifier to bypass your content index.

fromdisk:startwith:hex:binary:content:000000000000000000000000000000000000000000000000

fromdisk:



Use whole:content: to match files with no content. (file size might still be > 0)

whole:



Use size:0 to match empty files.
hamid56
Posts: 26
Joined: Sun Jul 20, 2014 9:38 am

Re: How to find empty files?

Post by hamid56 »

dear david
by fromdisk:startwith:hex:binary:content:000000000000000000000000000000000000000000000000
surprisingly we can find all iso and dcm and some other extension that have started with many zero file at header but not empty file.
void
Developer
Posts: 16770
Joined: Fri Oct 16, 2009 11:31 pm

Re: How to find empty files?

Post by void »

To find files that are all NULL characters:

regex:binarycontent:^\x00*$

binarycontent:



To find files that start with one or more NULL characters:

startwith:hex:content:00
-or-
regex:binarycontent:^\x00+
therube
Posts: 4985
Joined: Thu Sep 03, 2009 6:48 pm

Re: How to find empty files?

Post by therube »

To find files that start with one or more NULL characters:

regex:binarycontent:^\x00+
-or-
startwith:hex:content:00
Is that correct? [YES - see below]
Is binarycontent: looking for files that contain ONLY nul?
Is startwith: looking for files where the first byte is a nul?

I have a ubcd.iso.
The file starts with a number of nul (but is certainly not all nul).
The binarycontent: does not find ubcd (& is a timely search [scan of the data] at that).
The startwith: immediately finds ubcd.iso.
therube
Posts: 4985
Joined: Thu Sep 03, 2009 6:48 pm

Re: How to find empty files?

Post by therube »

Oh that's weird.
regex:binarycontent:^\x00+

Is there some sort of limit with that?
Or bug?

With smaller files (9 bytes or 32,768 or 58,353,664), that does find files that start with any number of nul.
But with a larger file, it fails?
(In this case "larger" is only 692,897,792 bytes)


Oh, it must be an x86 issue.

Code: Select all

failed to alloc 1025603363
failed to alloc 1025811579
failed to alloc 1025864362
failed to alloc 1025711180
So yes, regex:binarycontent:^\x00+ is correct.
Though with x86 Everything you can run out of "memory" on larger files.
void
Developer
Posts: 16770
Joined: Fri Oct 16, 2009 11:31 pm

Re: How to find empty files?

Post by void »

regex:binarycontent:^\x00+
is terribly inefficient.
This will load the entire file into memory to perform the search.


startwith:hex:content:00
will only load 1 byte of the file to perform the search.
Thy Grand Voidinesss
Posts: 691
Joined: Wed Jun 01, 2022 5:01 pm

Re: How to find empty files?

Post by Thy Grand Voidinesss »

So: is there a swift solution for a layman - in form adding a Filter?

How would Filter would need to look like in order to single out all empty files, no matter of what format they might be?
void
Developer
Posts: 16770
Joined: Fri Oct 16, 2009 11:31 pm

Re: How to find empty files?

Post by void »

To me, a file filled with NULLs is not empty.

Your results may vary.



To find files that have no size or are filled with NULLs:

size:0 | < startwith:hex:content:00 regex:binarycontent:^\x00+$>



To make a filter to find these files
  • In Everything, from the Search menu, click Add to filters....
  • Change the Name to: Empty or All NULLs
  • Change the Search to: size:0 | < startwith:hex:content:00 regex:binarycontent:^\x00*$>
  • Click OK.
Thy Grand Voidinesss
Posts: 691
Joined: Wed Jun 01, 2022 5:01 pm

Re: How to find empty files?

Post by Thy Grand Voidinesss »

I added this to my Everything as a Bookmark

Thank you for the info
voidme
Posts: 12
Joined: Sun Sep 27, 2020 9:54 pm

Re: How to find empty files?

Post by voidme »

void wrote: Thu Dec 07, 2023 8:10 am
regex:binarycontent:^\x00+
startwith:hex:content:00
will only load 1 byte of the file to perform the search.
I don't think that works (on my computer).
If I do:
startwith:hex:content:0000000000000000
The result is quicker than instant, and no files are found, while I know there are files starting with 0000000000000000.
void
Developer
Posts: 16770
Joined: Fri Oct 16, 2009 11:31 pm

Re: How to find empty files?

Post by void »

Everything will never index content as binary.

Please make sure you use the fromdisk: search modifier.
Post Reply