First, to explain what I want to do: I have a folder structure like this:

BSDS300\images\test\ -which contains JPEG files, and some other files(only .jpg files are of interest)
BSDS300\human\color\ -which contains many folders, in which I have .seg files with the same name as the .jpg file


What I want is to generate a text file in the first location with the same name as the .jpg file, which will contain the absolute paths of every location that contains a .seg file(with the same name)

what I've tryed so far, is something in the command prompt window:

for %f in (*.jpg) do echo %~ff

but this only writes the .jpg absolute path preceded by the word echo


if not exist "BSDS300\human" md "BSDS300\human"
if not exist "BSDS300\human\color" md "BSDS300\human\color"

(for %%d in (BSDS300\images) do (
    if exist "%%d" (
            pushd "%%d"
                for %%f in (*.jpg) do (
                    move "%%f" "BSDS300\human\color\%%f"
set /p pause=Finished. Press "enter" to exit.