devxlogo

Create a Touch utility

The SetCreationTime, SetLastWriteTime, and SetLastAccessTime methods of the System.IO.Directory class let you modify the date attributes of a file or directory:

' Change the access date- and time of all files in C:DOCS.For Each fname In Directory.GetFiles("c:docs")    File.SetLastAccessTime(fname, Date.Now)Next

The SetCreationTime can easily create a “touch” utility that modifies the last write time of all the files specified on its command line. Here’s it complete listing

' Change the access date- and time of all files whose name is' passed on the command line.Dim args() As String = Environment.GetCommandLineArgs' The first item in args is the EXE name, and must be skipped.Dim i As IntegerFor i = 1 To Ubound(args)    File.SetCreationTime(args(i), Date.Now)Next

Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.

See also  How Seasoned Architects Evaluate New Tech

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.