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

Example:
BSDS300\images\test\3096.jpg
BSDS300\human\color\1110\3096.seg
BSDS300\human\color\1109\3096.seg

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

setlocal

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"
                )
        popd
    )
))
set /p pause=Finished. Press "enter" to exit.
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.