Reputation: 11
My folder structure as follows
E:\test1\42\5440001\5338023\html
E:\test1\43\5440021\5338024\html
E:\test1\47\5440021\5638024\html
E:\test1\43\5448721\5339024\html
and so on...
Wherein HTML folder, ABC named sub-folder (common name in all folders) requires to delete.
Can any body help me on this by providing BAT script to delete all ABC sub folders in single shot.
Thanks in advance
Upvotes: 0
Views: 300
Reputation: 1165
Try this.
@ECHO OFF
CD "E:\test1"
FOR /D /R %%A IN (*ABC) DO RMDIR /S /Q %%A
Before you actually run the above script to delete the folders, you can confirm you'll be deleting the right ones with this script.
@ECHO OFF
CD "E:\test1"
FOR /D /R %%A IN (*ABC) DO ECHO %%A
I'd highly recommend running the second script first just to make sure you only get the folders you want.
Upvotes: 1