0

I have a list of files that I'm looking for in a directory. They are all JPG files. I need to know how to return a value which will only look once in the directory. This will be within an existing FOR loop, as the point of the For loop is to actually print out the list of missing files.

Here is a partial code listing:

for %%C in (front back cd artist icon) do  (
            if not exist "%%~B\%%~C.jpg" (
                if %AlbumInfo% == 0 (
                    echo %%~nxA - %%~nxB
                    set AlbumInfo = 1
                )
            echo   Missing: %%C.jpg
            )
        )

So basically, I want to know if any item in (front back CD artist icon) is found in an album directory, and if it is, then print the Album - Artist line once. As it is right now, it prints it out for every missing file, along with the missing file itself. I attempted to use the variable AlbumInfo to assist in this by setting it to 0 or 1. No luck. How can I do this, using the file list names as presented in the code? I can post the entire code if necessary.

Here is Sample Desired Output:

Album - Artist
<list files missing>
Josh
  • 3

1 Answers1

0

Final code. See the comments below for the changes.

for %%C in (front back cd artist icon) do  (
            if not exist "%%~B\%%~C.jpg" (
                if !AlbumInfo! == 0 (
                    echo %%~nxA - %%~nxB
                    set /A album += 1
                    set "Albuminfo=1"
                )
            echo   Missing: %%C.jpg
            set /A missing += 1
            )
        )

Two problems and fixes I had with this code:

Setting this:

if %AlbumInfo% == 0 (

To this:

if !AlbumInfo! == 0 (

Setting this:

set Albuminfo=1

To this:

set "Albuminfo=1"
Josh
  • 3