How to Do a Conditional find, move & delete the empty folders in one string command ??

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 Do a Conditional find, move & delete the empty folders in one string command ??

Post by Flourgrader »

Hello All,
I am using Everything 1.5 Alpha.....
I could do with a little bit of help here!
I want to work from the root folder down through the sub folders
I am sorting my music collection
which consists of 3,511 folders and 35,852 files
If there is less than 3 files in a folder
regardless whether they are *.flac or *.mp3 or cover album pics
I want to move these files into a central folder called "MixedMusic"
After I have done that I want to delete the empty folders the files resided in!
I know how to get as far as finding all the folders I want to work on by
using the command "descendant-count:<3"
I don't know how to complete the rest of the task?
Could some kind soul give me the string command that would
complete this task ?
Thank you guys & dolls..
void
Developer
Posts: 16734
Joined: Fri Oct 16, 2009 11:31 pm

Re: How to Do a Conditional find, move & delete the empty folders in one string command ??

Post by void »

I want to move these files into a central folder called "MixedMusic"
With your
descendant-count:<3
search, select all the files and move them to your MixedMusic folder.

Consider using Edit -> Advanced -> Advanced Move to preserve parent folder names.
For example:

Uncheck Regular expressions.
Old format:
C:\My Music\%1

New format:
C:\MixedMusic\<regexreplace:%1,"\\","_">


where C:\My Music is your music folder.

As example, this will move files from:
C:\My Music\folder1\folder2\folder3\file.mp3
to:
C:\MixedMusic\folder1_folder2_folder3_file.mp3

Advanced Move


After I have done that I want to delete the empty folders the files resided in!
To delete empty folders in C:\My Music, please search for:

"c:\my music\" empty:


Select all folders.
Press Alt + Enter.
Double check there are no files are found. (in case you are excluding files or folders from your Everything index)
Delete the empty folders.

empty:
Flourgrader
Posts: 94
Joined: Fri May 28, 2021 7:55 am

Re: How to Do a Conditional find, move & delete the empty folders in one string command ??

Post by Flourgrader »

Thank you David, your working example, it worked perfectly,
I am not very good with RegEx Code.
If I did not want to preserve the parent folder names
in the Target folder how would I express that ?
I would like it to look like:
Folder: MixedMusic
Files: all single files in here without parent folders ?
TY
void
Developer
Posts: 16734
Joined: Fri Oct 16, 2009 11:31 pm

Re: How to Do a Conditional find, move & delete the empty folders in one string command ??

Post by void »

If I did not want to preserve the parent folder names
in the Target folder how would I express that ?
Cut all the files from Everything and paste them in your Mixed Music folder in Windows Explorer.
Flourgrader
Posts: 94
Joined: Fri May 28, 2021 7:55 am

Re: How to Do a Conditional find, move & delete the empty folders in one string command ??

Post by Flourgrader »

Thank you David for the advise.
Yes that is what I have done...
Post Reply