Newbie problem perhaps but I cannot find a solution even after searching the board.
An unpacker program created a directory that was supposed to be a bunch of individual files. Instead it created a couple of thousand directories names similar to the file names with spaces and sometimes dashes in them. Each directory contains a single file similar to the the directory name:
Toplevel
Name of first directory
\Name of first directory file.pdf
Name - of second directory
\Name - of second directory file.pdf
...
etc.
I would like to create a batch file to recursively send the directory name to a second batch file that moves the file to Toplevel, then deletes the directory names.
Any assistance would be greatly appreciated.
Passing Directory Name with spaces in it
Moderator: DosItHelp
Re: Passing Directory Name with spaces in it
Code: Select all
@echo off &setlocal enableextensions
for /d /r %%d in (*) do call :up "%%d"
goto :eof
:up
move "%~1\*" "%~dp1" &&rd /q %1 2>nul
goto :eof
place in Toplevel & run