Scripts Thread, Remove Folders Using CMD in Coding and Web Development; So Bossman gave me the solution to a problem we're having with Symantec, and rather than run the solution manually ...
18th September 2009, 09:10 AM #1
Remove Folders Using CMD
So Bossman gave me the solution to a problem we're having with Symantec, and rather than run the solution manually on the machines as and when they suffer the problem (as it takes about 10 minutes) I thought I'd put it in a batch file to do it for me.
It's about done, but I need two things adding to my batch file:
1) Delete all folders (and files within them) from C:\Program Files\Common Files\Symantec Shared\VirusDefs where the folder name matches ????????.??? (where ? is a single wild card character)
2) Delete all folders (and files within them) from C:\Documents and Settings\All Users\Application Data\Symantec\Symantec AntiVirus Corporate Edition\7.5\I2_LDVP.VDB
The trouble I'm having is that you cannot use wild card characters in a batch file command such as RMDIR or RD. I think the way to do this would be with a loop, but I'm not sure where to start so any help would be appreciated.
IDG Tech News
18th September 2009, 10:03 AM #2
Don't have SAV but this looks relatively simple - just to clarify
Originally Posted by Hightower
(1), is there always only a single folder under VirusDefs that you wish to remove and no other files in the root VirusDefs folder, or are there multiple files in there and you want to specify a specific filename when running the batch to remove only one file?
(2) Is I2_LDVP.VDB the folder name? If you want everything gone from under it, can you do it the lazy way and just
or is this locked while SAV is running? If you need to do it in a loop, it should be
rd /s /q I2_LDVP.VDB (Remove I2_LDVP.VDB and all subfolders, no prompting)
md I2_LDVP.VDB (Recreate I2_LDVP.VDB)
del /q "C:\Documents and Settings\All Users\Application Data\Symantec\Symantec AntiVirus Corporate Edition\7.5\I2_LDVP.VDB\*"
for /D %%I in (C:\Documents and Settings\All Users\Application Data\Symantec\Symantec AntiVirus Corporate Edition\7.5\I2_LDVP.VDB\*) do RD /s /q "C:\Documents and Settings\All Users\Application Data\Symantec\Symantec AntiVirus Corporate Edition\7.5\I2_LDVP.VDB\%%I"
Thanks to OutToLunch from:
Hightower (18th September 2009)
18th September 2009, 10:27 AM #3
Thanks - that loop should get me going
18th September 2009, 02:13 PM #4
Need to use a wild card character in an if statement like:
So it is any 8 characters followed by a dot followed by any 3 characters.
if %%I == "????????.???" ECHO This works!
Anybody got any ideas how to do this because the above doesn't work.
18th September 2009, 02:21 PM #5
Originally Posted by Hightower
Lets you do it with regular expressions, which might make things much easier for you.
18th September 2009, 02:30 PM #6
findstr in a normal batch will let you use regex, should be able to get this to combine and do what you want but haven't got any time left this afternoon to play - findstr /? on the console will give you some ideas of what you can do with it.
By PiqueABoo in forum How do you do....it?
Last Post: 29th August 2009, 12:39 PM
By danboid in forum Windows
Last Post: 19th October 2008, 08:29 PM
By k-strider in forum Windows Server 2008
Last Post: 13th May 2008, 12:14 PM
By baronne in forum Scripts
Last Post: 20th August 2007, 02:20 PM
By secman in forum Windows
Last Post: 2nd November 2006, 01:42 PM
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)