Find files that do not exist 🤔

Discussion related to "Everything" 1.5 Alpha.
Post Reply
David.P
Posts: 200
Joined: Fri May 29, 2020 3:22 pm

Find files that do not exist 🤔

Post by David.P »

Hello Forum,

I have a list of 40 file names, and I would like to find out which of them do not exist on my hard drive.

Is this possible?
therube
Posts: 5003
Joined: Thu Sep 03, 2009 6:48 pm

Re: Find files that do not exist 🤔

Post by therube »

As a start...

distinct:name
or
unique:name

(depending on how you want to look at things,
& then depending on what turns up, or not)

& copy/paste your 40 filenames after "name ".

So,
distinct:name file1 | file2 | file3 | file4 | file5 | file6


When you copy/paste the file names into the Search bar, the OR's (|) should automatically be placed in there.
(So you copy; file1 file2 file3... & when you Paste, you get file1 | file2 | file3...)


"file1" "file2" "file3" is rather vague, so you might have to finagle things if you're getting more then wanted.
David.P
Posts: 200
Joined: Fri May 29, 2020 3:22 pm

Re: Find files that do not exist 🤔

Post by David.P »

Not sure if I get how this approach works.
If I search for
distinct:name file1 | file2 | file3 | file4 | file5 | file6
, I seem to get unique occurrences of any of the input file names.

But how do I see which of the file names have not been found?
NotNull
Posts: 5468
Joined: Wed May 24, 2017 9:22 pm

Re: Find files that do not exist 🤔

Post by NotNull »

Don't think that is possible within Everything.
Using the command-line tool ES.exe this should be possible.

What goes your list of files look like? One of the following 4 or something else?

Code: Select all

"C:\Windows\notepad.exe"
"C:\Windows\explorer.exe"

Code: Select all

C:\Windows\notepad.exe
C:\Windows\explorer.exe

Code: Select all

"notepad.exe"
"explorer.exe"

Code: Select all

notepad.exe
explorer.exe
David.P
Posts: 200
Joined: Fri May 29, 2020 3:22 pm

Re: Find files that do not exist 🤔

Post by David.P »

It's actually just a list of character strings, and I'd like to find out which character string does not occur in any file name.
NotNull
Posts: 5468
Joined: Wed May 24, 2017 9:22 pm

Re: Find files that do not exist 🤔

Post by NotNull »

If I understood correctly, this should work:

- save your strings in strings.txt (one per line)
- in CMD go the folder where strings.txt is.
- make sure es.exe is either in this folder or somewhere in %PATH%
- run the following command:

Code: Select all

for /f "delims=" %f in (strings.txt) do @for /f "usebackq delims=" %x in (`es.exe "%f" -getresultcount`)  do @if [%x]==[0] echo %f
This will list all patterns that are not in any file-/foldername.
David.P
Posts: 200
Joined: Fri May 29, 2020 3:22 pm

Re: Find files that do not exist 🤔

Post by David.P »

Thanks!

This is a bit over my head, but I'll try it as soon as the use case comes up again!
NotNull
Posts: 5468
Joined: Wed May 24, 2017 9:22 pm

Re: Find files that do not exist 🤔

Post by NotNull »

Subtitles for this command:

For each pattern (=line) in strings.txt, let es.exe search for that that pattern and report the number of results.
If the number of results is zero, show the pattern on the screen.
ChrisGreaves
Posts: 688
Joined: Wed Jan 05, 2022 9:29 pm

Re: Find files that do not exist 🤔

Post by ChrisGreaves »

NotNull wrote: Tue Jul 04, 2023 11:29 pmSubtitles for this command: For each pattern (=line) in strings.txt, let es.exe search for that that pattern and report the number of results. If the number of results is zero, show the pattern on the screen.
NotNull, thanks for the subtle subtitles.
Sad to relate they have not gotten me over the hurdle this time.
(1) I have es.exe set up correctly and it executes basic search commands, so I know I am running non-administrator, es.exe in same folder etc
es.exe -instance 1.5a *.doc dm:=02/08/2023

(2) Using your string as-is failed with the same dreaded IPC error, and yes, Everything 1.5a is running :-
CommandLine_17.png
CommandLine_17.png (29.24 KiB) Viewed 3971 times
(3) NOTHING stops me: I carve chunks out of your command and that works; my STRINGS.TXT is in my application folder and contains the names of two towns:
CommandLine_18.png
CommandLine_18.png (24.24 KiB) Viewed 3971 times
(4) THIS stops me :D because the rest of the command line defies my attempts to carve smaller bits out of it. In particular the usebackq is unfamilar to me.

That the IPC error occurs twice suggests that the error is related to the occurrence of each of my two strings in the STRINGS.TXT file.

Nothing expensive is riding on this; academic only, but I felt that it would be a fitting climax to a chapter on installing and using the command-line processor.

Thanks in advance for any suggestions you are able to make. Please don't spend hours on this.
Cheers, Chris
Attachments
strings.zip
(138 Bytes) Downloaded 198 times
ChrisGreaves
Posts: 688
Joined: Wed Jan 05, 2022 9:29 pm

Re: Find files that do not exist 🤔

Post by ChrisGreaves »

therube wrote: Tue Jul 04, 2023 3:09 pm distinct:name
or
unique:name
Hi therube.
I have been searching the wiki for these two search terms and cannot find them.
Please can you supply a link to some documentation?
Thanks, Chris
NotNull
Posts: 5468
Joined: Wed May 24, 2017 9:22 pm

Re: Find files that do not exist 🤔

Post by NotNull »

The errormessage "Error 8: Everything IPC window not found. Please make sure Everything is running." indicates that ES.exe can't find the right Everything instance (ES passes the query on to Everything, which looks in its database and passes the matching results back to ES).

You might need to specify the Everything instance you want ES to talk to as there can be multiple (named) instances of Everything running.
For example:
ES.exe -instance 1.5a searchtext.



TIP: If you don't want to specify the instance every time you want to use ES, you can run the following command (assuming instance 1.5a):

Code: Select all

es.exe -instance 1.5a -save-settings
This will save your preference in ES.ini in the ES.exe folder:

ES.ini

Code: Select all

[ES]
instance=1.5a
ChrisGreaves
Posts: 688
Joined: Wed Jan 05, 2022 9:29 pm

Re: Find files that do not exist 🤔

Post by ChrisGreaves »

NotNull wrote: Mon Jul 10, 2023 9:09 pmThis will save your preference in ES.ini in the ES.exe folder:
CommandLine_20.png
CommandLine_20.png (19.63 KiB) Viewed 3940 times
Got it!! Thank you NotNull. After I changed the "instance" settings I reran my simple tests (an abbreviated command-line statement) and then reran your example from above.
{{idiot alert}} Strangely the results were unchanged. Nothing came out.{{\\idiot alert}}
Then I thought to add "Mukinbudin" to the strings.txt file (attached) and because I have no files named after a remote wheat bin siding in the Western Australian wheat belt, your statement returned the result (image above) that "I have no files named after a remote wheat bin siding in the Western Australian wheat belt". :clappjng * 6:

Along the way I found that With the instance saved in the Settings, either command will work:-
CommandLine_19.png
CommandLine_19.png (43.97 KiB) Viewed 3940 times
OK. That's enough learning for me today :twisted:
I still don't fully understand your wonderful 130 characters statement; parts of it, yes, but I shall leave the remainder to another time.

Thanks again!
Chris
ChrisGreaves
Posts: 688
Joined: Wed Jan 05, 2022 9:29 pm

Re: Find files that do not exist 🤔

Post by ChrisGreaves »

David.P wrote: Tue Jul 04, 2023 1:16 pmI have a list of 40 file names, and I would like to find out which of them do not exist on my hard drive.
Hello david.
I confess that I was intrigued by the subject line.
"What" I thought "is the point of looking for something that isn't there?"

Now I can see that your statement would let one keep track of a project.
For example, if one were writing a User Tutorial for Everything, and wanted to have a chapter (document) on every heading in the wiki, it would be a simple matter to create (as NotNull points out) a Strings.txt that contained each subject, and continually check until one had a document for each subject!
Well Done!
Chris
therube
Posts: 5003
Joined: Thu Sep 03, 2009 6:48 pm

Re: Find files that do not exist 🤔

Post by therube »

distinct:name
or
unique:name
Search Functions
(/distinct:, should find it [in most browsers, I'd think])
therube
Posts: 5003
Joined: Thu Sep 03, 2009 6:48 pm

Re: Find files that do not exist 🤔

Post by therube »

Oh...

If you saved a listing of all your files to a file, say, xxx
If you saved your 40 names to a file, say 40

grep.exe -w -f 40 xxx > found
(read file 40, searching for wolewords that are found in xxx)

found should then contain names from 40 that ARE found

if you then

diff.exe found 40 > unique
grep.exe ">" unique > uniqueONLY

with that, uniqueONLY should contain a list of your UNIQUE file names

Maybe ;-).
Oh, there are probably a lot of gotchas in this.
And there is also many options to the different commands.
But... something like that may work?
ChrisGreaves
Posts: 688
Joined: Wed Jan 05, 2022 9:29 pm

Re: Find files that do not exist 🤔

Post by ChrisGreaves »

therube wrote: Tue Jul 11, 2023 3:20 pm Search Functions
(/distinct:, should find it [in most browsers, I'd think])
Thanks therube. I don't know how I missed it in my earlier search. It doesn't get much of a mention in Forum Posts.
Cheers, Chris
Post Reply