Sibling selector?

If you are experiencing problems with "Everything", post here for assistance.
Post Reply
Fraka
Posts: 27
Joined: Thu Jan 12, 2017 5:07 pm

Sibling selector?

Post by Fraka »

Hi,

I got some problems creating a search query.

Structure:

Code: Select all

D:\folder\bla.epub
D:\folder\bla.opf

D:\folder2\new.epub

D:\folder3\another.epub

D:\folder4\wow.epub
D:\folder4\wow.opf
I want to select .epubs only that don't have a .opf on the same level.
Goal is to select new.epub and another.epub to move them somewhere else.

I've fiddled around but seems like I am not experienced enough in the everything search syntax.

I appreciate your help.

Greetings,
Fraka
Stamimail
Posts: 1122
Joined: Sat Aug 31, 2013 9:05 pm

Re: Sibling selector?

Post by Stamimail »

I would try:
1. search for .opf
2. Select all results, and Copy Path (copy their locations)
3. Now you need to exclude all those paths (by using !"path"), and search for .epub
Fraka
Posts: 27
Joined: Thu Jan 12, 2017 5:07 pm

Re: Sibling selector?

Post by Fraka »

Thanks,
unfortunately that's not the way to go for me because there are actually ~200 folders and I expect half of them to have a .opf :cry:

/edit
Because the files are not so big, my workaround was like this:
Search for all folders that have an .opf

Code: Select all

"D:\Users\MyName\eBooks\#epub\#archive\#tolino\" parents:>6 child:.opf
Cut and paste them somewhere else temporarly

Search in the remaining folders for .epub and cut them, delete all empty folders

Copy back the .opf containing ones

Googlers: Beware, this is specific for my case. I do not take in account different folder substructures and other files around.
NotNull
Posts: 5458
Joined: Wed May 24, 2017 9:22 pm

Re: Sibling selector?

Post by NotNull »

Fraka wrote:Thanks,
Because the files are not so big, my workaround was like this:
So you are done now? (I might have another workaround)
Fraka
Posts: 27
Joined: Thu Jan 12, 2017 5:07 pm

Re: Sibling selector?

Post by Fraka »

Yes, my task is done.

Nonetheless I am interested for workarounds in sibling selector.
E.g. some music albums have the cover/booklet directly in the same folder, some have a subfolder. I'd like to unify this.
A sibling selector might be helpful there, too.
NotNull
Posts: 5458
Joined: Wed May 24, 2017 9:22 pm

Re: Sibling selector?

Post by NotNull »

Actually, u=you are not looking for siblings, but (to stay in his terminology) a lone child, without brothers /sisters

Workaround1:
EDIT: This was a bad idea involving namepartdupe: Deleted.


Workaround 2: (not tested)
- create an Everything query to find all your EPUB files
- Export the results as a textfile to some folder
- Put this script in the same folder

NoBrother.CMD

Code: Select all

for /f "usebackq delims=" %%A in (%1) DO (
  if not exist "%%~dpnA.opf" ( move "%%A" "c:\New\My Folder\" &  rd "%%~dpA" 2>nul )
)
-Drag the result txt file to this script.

For each .EPUB file, It will check if there is a .opf file in that folder with the same name. If that's not the case (no brother). the file will be moved to the "c:\New\My Folder\" folder (aadapt this to your situation)
After that, it will try to remove the folder where the .epub file was. That will only succeed if that folder is empty.
Fraka
Posts: 27
Joined: Thu Jan 12, 2017 5:07 pm

Re: Sibling selector?

Post by Fraka »

Hmm not much everything in your workaround :D

But yes, this looks promising and should work on all Windows systems.
Bookmarked it. Thanks!

p.s.: I call everything sibling that is on the same directory (level). In this case there should be no sibling of .opf, but I might like e.g. .m3u files only together with .mp3 files.
Post Reply