search though all of c: and delete wild card (Full Version)

All Forums >> [Management Products] >> Microsoft Systems Management Server >> SMS 2003



Message


mbinetti -> search though all of c: and delete wild card (9/23/2008 2:46:05 PM)

what i need to do is search from the root of c:\ and delete the directoires and all of its subfolders and files does anyone know an easy way ...
i foud this

strFolderName = "C:\Test"
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FolderExists(strFolderName) Then
fso.DeleteFolder strFolderName
End If
MsgBox "Done"

but i want it to search trough everything for "vectorworks* " there are different version of vecotr works out there so i need to find all vectorworks*




jnelson993 -> RE: search though all of c: and delete wild card (9/23/2008 4:51:30 PM)

Because I'm so m@d with tha ol' skool skillz, I like to use .BAT files for that stuff.  RMDIR /Q /S is really good at axing folders and subfolders.  So you just need to use DIR to enumerate all folders on the c: drive that start with "vectorworks*" and then operate on each of them.  Something like this:

@echo off
SETLOCAL enabledelayedexpansion

FOR /F "usebackq tokens=*" %%A  IN (`dir /S /B /AD c:\vectorworks*`) DO (
   ECHO Removing folder "%%A"
   IF EXIST "%%A" rmdir /q /s "%%A"
)
exit 0






Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.171875