Excluding a certain folder level, but not its subfolders

General discussion related to "Everything".
Post Reply
donotbugme
Posts: 23
Joined: Mon Oct 16, 2017 10:33 am

Excluding a certain folder level, but not its subfolders

Post by donotbugme »

The situation is that I've recently decompressed some 7z files, some of which have folders inside. I wish to take out the folders inside the folders that unzipping them made, rather, the "second layer" of folders.

Example:

If we take "Main Folder" where compressed files bla3.7z, bla4.7z, blabla5.7z, "Real Name 1.7z", "Real Name 2.7z" were unzipped using Extract to: "*\" using 7-zip.
The folders become:

Main Folder\bla3\Real Folder Name
Main Folder\bla4\Authentic Folder Name 2
Main Folder\blabla5\Genuine Folder Name 3
Main Folder\Real Name 1
Main Folder\Real Name 2\Act 1
Main Folder\Real Name 2\Act 2

How does one select only the second "layer" of folders (Real Folder Name, Authentic Folder Name 2, Genuine Folder Name 3)?

The outcome is to move them into the main folder, then delete the empty folders (those in bold) with the nonsense names.

Also, some of the "Real Name" folders have folders "Act 1" and "Act 2" in them, more specifically, folders inside the "Real Name" folders, which I want to exclude from the search as well.

How do I do this, or how do I learn how to do this?
vanisk
Posts: 152
Joined: Sat Oct 27, 2018 11:33 am

Re: Excluding a certain folder level, but not its subfolders

Post by vanisk »

In my understanding, you want to find folders which has ONLY one child and its a FOLDER!, right?

If thats the case then, try

Code: Select all

childcount:1 childfoldercount:1
If not, please explain a little bit more, so some one else can help you with the query.
donotbugme
Posts: 23
Joined: Mon Oct 16, 2017 10:33 am

Re: Excluding a certain folder level, but not its subfolders

Post by donotbugme »

Thank you for replying. Because of your answer, I found out about the other functions in the "Search Syntax Help" which I couldn't easily find online.

I ended up using something like this:
folder:"C:\Main Folder" !folder:infolder:"C:\Main Folder" parents:3


So using the example:

Main Folder\bla3\Real Folder Name
Main Folder\bla4\Authentic Folder Name 2
Main Folder\blabla5\Genuine Folder Name 3
Main Folder\Real Name 1
Main Folder\Real Name 2\Act 1
Main Folder\Real Name 2\Act 2

folder:"C:\Main Folder" !folder:infolder:"C:\Main Folder" parents:3
would come up with:
Real Folder Name
Authentic Folder Name 2
Genuine Folder Name 3

as well as the unwanted:
Act 1
Act 2

I first selected all the folders with the "Real Names", and moved them to a folder external to "C:\Main Folder". I then used:
empty:"C:\Main Folder"

to delete the empty folders. After that, I went into explorer and moved out the remaining folders (The folders containing "Act 1" and so on, as well as the folders that had proper names outright) into the folder external to "C:\Main Folder", completing the intended result.

If someone could please point out the extraneous portions of the query
folder:"C:\Main Folder" !folder:infolder:"C:\Main Folder" parents:3
, or demonstrate how to exclude the "Act 1" and "Act 2" folders as well, it would be most helpful in case that this happens once more. Thank you again.
tuska
Posts: 1052
Joined: Thu Jul 13, 2017 9:14 am

Re: Excluding a certain folder level, but not its subfolders

Post by tuska »

... "Search Syntax Help" which I couldn't easily find online.
F1 in Everything - Searching... (Web) ... [or menu "Help"...]
... I ended up using

Code: Select all

"C:\Main Folder\" folder:parents:3
... demonstrate how to exclude the "Act 1" and "Act 2" folders as well

Code: Select all

"C:\Main Folder\" folder:parents:3 !"Act*"
or

Code: Select all

"C:\Main Folder\" folder:parents:3 !<"Act 1"|"Act 2">
Post Reply