The procedure for requesting AWR support has changed. Please read all about the new AWR product support process.
Page tree
Skip to end of metadata
Go to start of metadata

The Microsoft scripting runtime provides advanced file operations as described in a Scripting How-To: File System Objects but sometimes you just need to do some basic file operations and don't want to include the scripting runtime. This article describes some simple file operations available.

Create a directory only if needed

 Sub CreateIfNeeded(directoryname)
        ' error generated if directory exists
        On Error GoTo DirExists
        MkDir(directoryname)
DirExists:
End Sub


Delete a file if it exists

 Sub FileDeleteIfExists(filename As String)
        If (fileexists(filename)) Then
                Kill(filename)
        End If
End Sub


Check if a file exists

 
Function fileexists(filename As String) As Boolean
        On Error GoTo missing
        GetAttr(filename)
        fileexists = True
        Exit Function
missing:
        fileexists = False
End Function
 

Rename a file

Name originalname AS newname

Delete a file

Kill filename