Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Batch file for deleting subdirectorys  (Read 4493 times)

0 Members and 1 Guest are viewing this topic.

axe2grind

  • Guest
Batch file for deleting subdirectorys
« on: February 03, 2005, 02:08:52 PM »
Hi new here...I did a search and read through a few related topics but couldn't put together something for my needs ???.

I created a batch file to delete all the directories and subdirectories labeled "CVS" from my root directory.

This what I came up with but it only deletes the CVS folder in the root directory then says
"The system cannot find the file specified" when I continue through the loop.


for /f %%i in ('dir') do rmdir CVS. /s

If someone could give me a hint as to what I'm doing wrong I would greatly appreciate it. Thanks. ;D

Ok its re-checking the same folder :D....now to see if I can figure out how to make it check the subfolders for subfolders ans delete em.
« Last Edit: February 03, 2005, 08:02:17 PM by axe2grind »

Gommer

  • Guest
Re: Batch file for deleting subdirectorys
« Reply #1 on: February 11, 2005, 09:59:56 AM »
set Folder=?
FOR /f "delims=" %%i IN ('DIR /b %Folder%') DO IF EXIST %Folder%%%i\nul ( rmdir %Folder%%%i )