0

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.

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Aia
0
'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
)

Edited by Aia: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.