Thursday, July 10, 2008

Write the Data Into Notepad

Dim a, b
Const ForReading = 1, ForWriting = 2, ForAppending = 8
set a = createobject ("Scripting.FileSystemObject")
Set b = a.Getfile("c:\Vinodh.txt")
Set b = a.opentextfile("c:\Vinodh.txt",ForWriting, True)
b.write "Vinodh from Bangalore"
Set b = a.opentextfile("c:\Vinodh.txt",ForReading, True)
filespec = ("c:\Vinodh.txt")
ShowFileAccessInfo(filespec)
print ShowFileAccessInfo
Function ShowFileAccessInfo(filespec)
Dim fso, f, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFile(filespec)
s = f.Path & "
" s = s & "Created: " & f.DateCreated & "
" s = s & "Last Accessed: " & f.DateLastAccessed & "
" s = s & "Last Modified: " & f.DateLastModified ShowFileAccessInfo = s
End Function

No comments: