Page 1 of 2

find folders without mp3 file

Posted: 2008 Oct 22, 17:07
by lin
I have a folder " 1mm" with many subfolders,these contain jpg and mp3 files ; i am trying to figure out how i can search these subfolders with as result the folders which have jpg files but not mp3 files .
thanks,lin

Posted: 2008 Oct 22, 17:45
by nikos
can't think of anything except flattening everything, then marking all MP3 in the scrap, removing them and seeing what's left

Users' Challenge - III

Posted: 2008 Oct 22, 18:03
by fgagnon
That's the only thing I could think of, too.
But it's messy in that there will be as many entries for each folder as there are for .jpg files.
And I don't know how to efficiently remove folders that have both jpg's and mp3's without manually trolling through the list.

If it is even possible to do in straightforward manner, it is a candidate for a Users' Challenge, ref: this thread & post.  :twisted:

Posted: 2008 Oct 22, 19:18
by Mr.Pleasant
I would try it this way:
1. Go in the left hand pane to the folder 1mm.
2. In the right hand pane, open a random empty folder somewhere outside 1mm.
3. Go to the left hand pane, select all, and open a Robust Copy dialog (F5).
4. Define a Filter, with '*.mp3' in the 'Named' field. For the rest use normal copy settings. This will copy only mp3 files, and the folders in which they are placed.
5. Open the synchronization wizard (ctrl+F9), and compare 'Unique' items on 'Name only', with 'Consider folders, too' checked.
The folders which get selected won't contain any mp3 files in the folder itself or in any of its subfolders.

I don't know if this works for you, because this also means that the UNselected folders might contain one or more subfolders without mp3 files. You just have selected folders on the root level of 1mm.

I think it is possible to get a selection of all deeper subfolders without mp3 files, but I can only think of much more complicated methods.

Posted: 2008 Oct 22, 19:50
by lin
Thank you all for helping out.
there are 540 subfolders , 130 gig ,so i'd better not try any of these solutions.
i do have an alternative way of doing this in my media db although somewhat cumbersome ; i just wondered if there was an easy fast way to do this .
Lin

Re: Users' Challenge - III

Posted: 2008 Oct 22, 19:54
by lin
fgagnon wrote:That's the only thing I could think of, too.
But it's messy in that there will be as many entries for each folder as there are for .jpg files.
And I don't know how to efficiently remove folders that have both jpg's and mp3's without manually trolling through the list.
I only want to remove the folders with no mp3's in it.
All the folders have jpg in it.

Posted: 2008 Oct 22, 20:15
by tonne
If the subfolders are at first level this script will handle the folders

Code: Select all

@echo off
for /D %%d in (*.*) do if not exist %%d\*.mp3 del %%d\*.* & rmdir %%d 
EDITED: away went my testcase...

save as a .cmd file and run it from a cmd-prompt (two lines).

NOTE this will delete all files and remove the folder - try it on a test subset first!

Posted: 2008 Oct 22, 20:29
by lin
tonne wrote:If the subfolders are at first level this script will handle the folders

Code: Select all

@echo off
for /D %%d in (*.*) do if not exist %%d\*.mp3 del %%d\*.* & rmdir %%d 
EDITED: away went my testcase...

save as a .cmd file and run it from a cmd-prompt (two lines).

NOTE this will delete all files and remove the folder - try it on a test subset first!
Thanks ,could you elaborate please , i'm not good on scripts ;the subfolders are located below : H:\1mm\   where would i put this path?

Posted: 2008 Oct 22, 20:39
by tonne
Start a cmd-prompt (start/run/cmd.exe), change active drive h: change active directory cd \1mm (save the script in this folder) and start the script.
Remember to make a test-case or start with this only listing the folders without mp3 files.

Code: Select all

@echo off
for /D %%d in (*.*) do if not exist %%d\*.mp3 echo %%d 

Posted: 2008 Oct 22, 21:47
by lin
tonne wrote:Start a cmd-prompt (start/run/cmd.exe), change active drive h: change active directory cd \1mm (save the script in this folder) and start the script.
Remember to make a test-case or start with this only listing the folders without mp3 files.

Code: Select all

@echo off
for /D %%d in (*.*) do if not exist %%d\*.mp3 echo %%d 
only the listing works ok, but i get : " The syntax of the command is incorrect." using the delete code.
Lin
EDIT i put the code on 2 lines like you said ,i now get : "The system cannot find the file specified."

Posted: 2008 Oct 23, 11:53
by Kilmatead
For a slightly less nuts and bolts approach, try this handy little freeware programme designed specifically for finding/removing empty folders.  A simple option can be set to not consider *.JPG's, thus considering the folder empty if no other file types exist.  Very handy for managing those pesky multi-foldered music collections.  (Obviously nothing is deleted without confirmation, so it's safe to experiment with.)

RED (Remove Empty Directrories

Happily works in XP or Vista, any flavour.

Posted: 2008 Oct 23, 13:47
by lin
Kilmatead wrote:For a slightly less nuts and bolts approach, try this handy little freeware programme designed specifically for finding/removing empty folders.  A simple option can be set to not consider *.JPG's, thus considering the folder empty if no other file types exist.  Very handy for managing those pesky multi-foldered music collections.  (Obviously nothing is deleted without confirmation, so it's safe to experiment with.)

RED (Remove Empty Directrories

Happily works in XP or Vista, any flavour.
Thank you for thr tip, but this issue is incidential  ,no use installing an app just  to use it once.
Cheers,lin

Posted: 2008 Oct 23, 14:29
by Kilmatead
lin wrote:...no use installing an app just  to use it once.
It's a pity bloated malware like Adobe-(anything) and the like have instilled an honest dislike of any superfluous installation procedures.  Fair enough, I try to run a clean ship too.  Unwarranted in this case.  It's harmless, unintrusive, and surprisingly handy in the unknown future.  And far less likely to lead to accidental "Oops" moments as ad hoc scripting has been known to do. :D

To each their own.

Posted: 2008 Oct 23, 14:41
by desslok
If you extract RED with Universal Extractor, you can use it out of the box. In other words it's portable. It still needs .NET though.

Posted: 2008 Oct 23, 15:23
by tonne
The two lines are:
Line1:

Code: Select all

@echo off
Line2:

Code: Select all

for /D %%d in (*.*) do if not exist %%d\*.mp3 echo %%d 
Which windows version - it works fine on vista.