So here's my issue. I recently merged music libraries with a friend of mine, and I've been deleting some stuff that I don't like or whatever. The problem is my zune doesn't delete the folders the music was stored in, and keeps the album artwork stored as well. I want to delete all the artwork files, delete the album folders, and then delete the artist folder as well.
The directory tree goes like F:\Music\<artist>\<album>\*.jpg
Here's what I have, but it's [obviously] not working. I'm running it from F:\Music.

for /f "tokens=* delims= " "%%d" in ('dir /b /a-d') do (
    cd "%%d"
    for /f "tokens=* delims= " "%%d" in ('dir /b /a-d') do (
        cd "%%d"
        if not exist *.mp3 for /f "tokens=* delims= " "%%f" in ('dir /b /a-d *.jpg') do (
            del "%%f"
            )
        cd ..
        rd "%%d"
    )
    cd ..
    rd "%%d"
)

ps I'm relatively new to batch script.
Cheers for any help.

'dir /b /a-d'

The hyphen will do the opposite to what you want DIR /B /A:D will list only directories.

Nevertheless, you don't need any of that. Following your logic and given information.

FOR /D %%A IN (*) DO (
    FOR /D %%B IN (%%A\*) DO (
       if not exist %%B\*.mp3  rmdir /s /q %%B
    )
    RD /q %%A
)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.