Zend certified PHP/Magento developer

Batch file to rename and move file to parent directory

Please help. I have a batch file that renames the first file in a folder to the name of the folder it’s in and move that file to the folders parent directory. The problem I’m facing is that if there are multiple files they all move out to parent directory. I only need to move that renamed file and not the rest. Here’s my code:

FOR /D /R %%# in (*) DO (
    PUSHD "%%#"
    FOR %%@ in ("*.*") DO (
        Echo Ren: ".%%~n#%%@" "%%~n#%%~x@"
        Ren "%%@" "%%~n#%%~x@"
        move *.* .. 2>NUL
    )
    POPD
)
Pause&Exit

I took the code from somewhere I can’t remember where from and added move *.* .. 2>NUL but I honestly don’t know what I’m doing.
Thanks in advanced!