Paul
Wed Mar 05 16:11:33 CST 2008
"XP" <XP@discussions.microsoft.com> wrote in message
news:CDA150AA-29BA-4A07-A48B-E13852D3E06A@microsoft.com...
> I'm developing an HTA in which I need to delete all files in a
> folder. I was
> surprised to find that the following doesn't work?
>
> Kill MyPathName & "*.*"
>
> Does this mean I have to loop thru all the files in the folder using
> FSO?
>
> Is there a more efficient/expedient method?
>
> Thanks much in advance for your assistance.
Have you tried looking for a 'deletefolder' method in the scripting
help file? SCRIPT56.CHM should be on your system, or you can download
it:
http://www.microsoft.com/downloads/results.aspx?pocId=&freetext=chm&DisplayLang=en
Once the folder (and its contents) is gone, you can create a new one
at the same path with the CreateFolder method.
object.DeleteFolder ( folderspec[, force] );
Arguments
object
Required. Always the name of a FileSystemObject.
folderspec
Required. The name of the folder to delete. The folderspec can contain
wildcard characters in the last path component.
force
Optional. Boolean value that is true if folders with the read-only
attribute set are to be deleted; false (default) if they are not.
Remarks
The DeleteFolder method does not distinguish between folders that have
contents and those that do not. The specified folder is deleted
regardless of whether or not it has contents.
-Paul Randall