Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: VBNET
Expertise: beginner
Feb 21, 2002



Application Security Testing: An Integral Part of DevOps

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)
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 Integer
For i = 1 To Ubound(args)
    File.SetCreationTime(args(i), Date.Now)
Francesco Balena
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date