FileSystemInfo.LastAccessTime Property gets or sets the time the current file or directory was last accessed. : FileSystemInfo « File Directory « VB.Net

Home
VB.Net
1.2D
2.Application
3.Class
4.Data Structure
5.Data Types
6.Database ADO.net
7.Date Time
8.Development
9.Event
10.File Directory
11.Generics
12.GUI
13.Internationalization I18N
14.Language Basics
15.LINQ
16.Network Remote
17.Reflection
18.Security
19.Thread
20.Windows Presentation Foundation
21.Windows System
22.XML
23.XML LINQ
VB.Net Tutorial
VB.Net by API
VB.Net » File Directory » FileSystemInfoScreenshots 
FileSystemInfo.LastAccessTime Property gets or sets the time the current file or directory was last accessed.
 

Imports System
Imports System.IO

Public Class Touch
    Public Shared Sub Main(ByVal args() As String)
        If args.Length > Then
            If File.Exists(args(0)) Then
                Dim fi As FileInfo = New FileInfo(args(0))
                touchFile(fi)
            Else
                Console.WriteLine("Could not find the file {0}", args(0))
            End If
        Else
            Console.WriteLine("No file specified.")
        End If
    End Sub

    Public Shared Sub touchFile(ByVal fsi As FileSystemInfo)
        Console.WriteLine("Touching: {0}", fsi.FullName)
        Try
            fsi.CreationTime = DateTime.Now
            fsi.LastAccessTime = DateTime.Now
            fsi.LastWriteTime = DateTime.Now
        Catch As Exception
            Console.WriteLine("Error: {0}", e.Message)
        End Try
    End Sub
End Class

   
  
Related examples in the same category
ww_w_._j___a___v__a__2___s_.c___o__m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.