/bundles/itninjaweb/img/Breadcrumb_cap_w.png
I've had a problem bugging me for quite a while now and I've been unable to find a good solution. I'm looking for something like this: someutility.exe C:\Windows\Temp\*.* /q This would delete everything in the temp folder silently but NOT touch the temp folder itself. So no rd command. And my ultimate would be a way to delete the Microsoft patch uninstall folders in the Windows directory that start with a "$"... I'd even consider a script for that one. There just doesn't seem to be an easy way to delete folders in windows using a wildcard. Anyone have ideas on this one? I need to do some cleanup before distributing an in-house package.
0 Comments   [ - ] Hide Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity

Answers

0
You can remove files using VBS script. An example (from VBS help)
[font="courier new"]Sub DeleteAFile(filespec, force)
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
fso.DeleteFile filespec, force
End Sub
filespec should have wildcards, therefore to remove everything from c:\Windows\temp folder you call this function this way:
Add a new custom action (VBS script stored in binary data or as a property) called CleanUp:

[font="courier new"]Function CleanUp()
DeleteAFile "c:\Windows\temp\*.*", true
CleanUp = 1 ' means success
End Function

Sub DeleteAFile(filespec, force)
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
fso.DeleteFile filespec, force
End Sub



BR
Answered 01/15/2008 by: jamsek19
Orange Senior Belt

Please log in to comment