I have many directories with some sub-directories that need to be deleted. Is there a way to deltree/rmdir so that all directories titled "TAB", "Tab_old" and files in them are deleted.
Directory structure is like
root>townx>TAB
root>towny>
root>towny>TAB
root>towny>zone1>
root>towny>zone1>Tab
etc... so all "TAB" directories should be deleted.
===== edmastermind29 suggested process output ====
$ find / -name "TAB" -type d -exec rm -rf {} \;
atgisuser@ATGISLAPTOP02 /c/scratch/Test_Lidar
$ ls
Ath_test.csv LAS Success_LOG.txt asc
Contours Orthophotomosaic XYZ schema.ini
atgisuser@ATGISLAPTOP02 /c/scratch/Test_Lidar
$ cd contours
atgisuser@ATGISLAPTOP02 /c/scratch/Test_Lidar/contours
$ ls
Atherton TAB
atgisuser@ATGISLAPTOP02 /c/scratch/Test_Lidar/contours
$
The "TAB" directory above should be deleted...
Here is a Windows CMD solution
for /f "delims=" %F in ('dir /b /s /ad x:\rootFolder ^| findstr /le "\TAB \Tab_old"') do 2>nul rd /s /q "%F"
If used in a batch script, then %F
must change to %%F