Task

Delete a file called "input.txt" and delete a directory called "docs".

This should be done twice: once "here", i.e. in the current working directory and once in the filesystem root.




Set oFSO = CreateObject( "Scripting.FileSystemObject" )
 
oFSO.DeleteFile "input.txt"
oFSO.DeleteFolder "docs"
 
oFSO.DeleteFile "\input.txt"
oFSO.DeleteFolder "\docs"
 
'Using Delete on file and folder objects

dim fil, fld
 
set fil = oFSO.GetFile( "input.txt" )
fil.Delete
set fld = oFSO.GetFolder( "docs" )
fld.Delete
 
set fil = oFSO.GetFile( "\input.txt" )
fil.Delete
set fld = oFSO.GetFolder( "\docs" )
fld.Delete
 
 