G
Guest
Hi there,
I am trying to write a batch file that takes as an arquemant a directory to
look for, searches the current directory and all sub directories for a
directory of that name and deletes each one it finds.
The command that I am using is
FOR /F %%i IN ('dir /b /s /ad %1*') DO rd %%i
and the problem is that if I have a directory structure say dir\dir the
script deletes the sub directoryvand not the top level dir.
Could someone please advise why this is so and how I can modify this
behaviour.
Am I using the right command to display all directories below the current of
a given name. I have noted that the command "dir /b /ad dir_Name" displays
the
contents of directoty named dir_Name but wont list directories in the
current directory named dir_Name.
Regards,
James.
I am trying to write a batch file that takes as an arquemant a directory to
look for, searches the current directory and all sub directories for a
directory of that name and deletes each one it finds.
The command that I am using is
FOR /F %%i IN ('dir /b /s /ad %1*') DO rd %%i
and the problem is that if I have a directory structure say dir\dir the
script deletes the sub directoryvand not the top level dir.
Could someone please advise why this is so and how I can modify this
behaviour.
Am I using the right command to display all directories below the current of
a given name. I have noted that the command "dir /b /ad dir_Name" displays
the
contents of directoty named dir_Name but wont list directories in the
current directory named dir_Name.
Regards,
James.