Converting the FileSystemObject's DeleteFolder Method

Definition: Deletes one or more folders.

DeleteFolder

See Delete. The only difference between Delete and DeleteFolder is that DeleteFolder allows you to delete more than one folder at once. You can use the Remove-Item cmdlet to delete multiple folders. For example, you can use wildcards to delete all the folders beginning with te from the C:\scripts folder:

Remove-Item C:\scripts\te*
del C:\scripts\te*

And don’t forget, if you want to automatically delete everything without being prompted, use the -recurse parameter:

Remove-Item C:\scripts\te* -recurse

See conversions of other FileSystemObject methods and properties.
Return to the VBScript to Windows PowerShell home page