ssearles wrote:From within an installation routine, if i have a directory tree that I can identify with a wildcard (in this case it's a series of subdirs in a location that all start with 'a*') and want to simply clean out, but leave the folders in place.... how best would I be able to do that?
Hello ssearles,
in a custom action script written in Javascript or VBScript you can use the method FileSystemObject.DeleteFolder(...) (
http://msdn.microsoft.com/en-us/library ... S.85).aspx) to delete directory trees.
You will have to get a list of all folders in the directory in question and check each wether its name starts with "a", and if it does execute FileSystemObject.DeleteFolder(...) for it and recreate it. Or get the list of the files and folders in those directories and issue DeleteFolder and DeleteFile respectively on each. Also, be prepared that the deletion might fail, and make your script handle this gracefully by catching exceptions, retrying, etc.
Be aware that scripting in Windows Installer is a little painful. Use exception handling and WScript.Shell.Popup(...) (
http://msdn.microsoft.com/en-us/library ... S.85).aspx) and popup messages in case of errors while developing, if it becomes too confusing/frustrating to guess where it failed.
Bye bye
clemens
FOLLOW US
Get the latest news in Application Packaging