Update Directory: create time, last access time and last write time : Directory « 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 » File Directory » DirectoryScreenshots 
Update Directory: create time, last access time and last write time
Update  Directory: create time, last access time and last write time
 
Imports System.IO

Module Module1

    Sub Main()
        If (Directory.Exists("C:\WINNT\Temp")) Then
            Dim Dir As New DirectoryInfo("C:\WINNT\Temp")

            Dim DateTimeNow As DateTime = DateTime.Now()
            Try
                Dir.CreationTime = DateTimeNow
                Dir.LastAccessTime = DateTimeNow
                Dir.LastWriteTime = DateTimeNow

                Console.WriteLine("Directory attributes updated")
            Catch As Exception
                Console.WriteLine("Error updating attributes")
                Console.WriteLine("Error {0}: ", E.Message)
            End Try
        Else
            Console.WriteLine("C:\WINNT\Temp does not exist")
        End If

    End Sub

End Module


           
         
  
Related examples in the same category
1.Get all directories
2.Recursive Directory InfoRecursive Directory Info
3.Display Directory TreeDisplay Directory Tree
4.List files and directories in rootList files and directories in root
5.Directory Information: name, last update and create timeDirectory Information: name, last update and create time
6.Get Root directory and current directoryGet Root directory and current directory
7.Directory SeparatorDirectory Separator
8.Get Current DirectoryGet Current Directory
9.Get file in the parent folder Get file in the parent folder
10.Display all file under a DirectoryDisplay all file under a Directory
11.Find a file: search directory recursively
12.Directory Class Exposes static methods for creating, moving, and enumerating through directories and subdirectories
13.Move the directory
14.Count the files in a directory
15.Calculate the size of a directory and its subdirectories and displays the total size in bytes.
16.Gets or sets the attributes for the current file or directory.
17.FileSystemInfo.LastAccessTime Gets or sets the time the current file or directory was last accessed.
18.Path Class performs operations on file or directory path
19.Directory.CreateDirectory
20.Directory.Delete deletes an empty directory from a specified path.
21.Deletes the specified directory and subdirectories and files in the directory.
22.Directory.EnumerateDirectories returns an enumerable collection of directory names in a specified path.
23.Returns an enumerable collection of directory names that match a search pattern in a specified path.
24.Returns directory names that match a search pattern in a specified path, and optionally searches subdirectories.
25.Determines whether the given path refers to an existing directory on disk.
26.Gets the creation date and time of a directory.
27.Gets the creation date and time, in Coordinated Universal Time (UTC) format, of a directory.
28.Gets the current working directory of the application.
29.Gets the names of subdirectories in the specified directory.
30.Gets an array of directories matching the specified search pattern from the current directory.
31.Returns the names of files (including their paths) that match the specified search pattern in the specified directory.
32.Returns the date and time the specified file or directory was last accessed.
33.Returns the date and time the specified file or directory was last written to.
34.Sets the date and time the specified file or directory was last accessed.
35.Sets the date and time a directory was last written to.
36.Returns an enumerable collection of file names in a specified path.
37.Returns file names that match a search pattern in a specified path.
38.Returns file names that match a search pattern in a specified path, and optionally searches subdirectories.
39.Returns the volume information, root information, or both for the specified path.
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.