Quantcast
Channel: Tech Support Guy
Viewing all articles
Browse latest Browse all 38405

DOS Batch File to Delete Certain Folders Based on Name

$
0
0
I am going to reference this previous post as it is close to what I am trying to do but not quite.

http://forums.techguy.org/dos-other/...e-certain.html

I am attempting to create a .bat file that will delete folders with specific characters but leave other folders. I plan on scheduling this to run on a certain date that I will do with task scheduler.

The sub-folders I need removed always contain “fic_” at the beginning and may contain random characters after the “_” . The other sub-folders need to remain in the directory

This is the code I am using that is not working. I am running this on Windows 2003 R2

@echo off
pushd "C:\TempDir\"
for /F "tokens=*" %%I in ('dir /b ^| findstr /B /I /C:"fic"') do echo rmdir /q /s "%%I"
popd

Viewing all articles
Browse latest Browse all 38405

Trending Articles