Hightower Posted September 18, 2009 Posted September 18, 2009 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. Thanks,
OutToLunch Posted September 18, 2009 Posted September 18, 2009 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. Thanks, Don't have SAV but this looks relatively simple - just to clarify (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 rd /s /q I2_LDVP.VDB (Remove I2_LDVP.VDB and all subfolders, no prompting) md I2_LDVP.VDB (Recreate I2_LDVP.VDB) or is this locked while SAV is running? If you need to do it in a loop, it should be 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" 1
Hightower Posted September 18, 2009 Author Posted September 18, 2009 Thanks - that loop should get me going
Hightower Posted September 18, 2009 Author Posted September 18, 2009 Need to use a wild card character in an if statement like: if %%I == "????????.???" ECHO This works! So it is any 8 characters followed by a dot followed by any 3 characters. Anybody got any ideas how to do this because the above doesn't work.
jamesb Posted September 18, 2009 Posted September 18, 2009 Need to use a wild card character in an if statement like: if %%I == "????????.???" ECHO This works! So it is any 8 characters followed by a dot followed by any 3 characters. Anybody got any ideas how to do this because the above doesn't work. Use PowerShell? Lets you do it with regular expressions, which might make things much easier for you.
OutToLunch Posted September 18, 2009 Posted September 18, 2009 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.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now