Hi,
How can I change/set Modified date of a folder?
Please help
Printable View
Hi,
How can I change/set Modified date of a folder?
Please help
try this
VB Code:
Dim d As DirectoryInfo d = New DirectoryInfo(My.Computer.FileSystem.SpecialDirectories.Desktop & "\your Folder") d.CreationTime = Now
I tried this:But the modified date for that particular folder is not showing in Windows explorer. Not sure why?VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button1.Click Dim dir1 As New DirectoryInfo("C:\Temp\Word8.0") dir1.CreationTime = CDate("February 12, 1969") dir1.LastAccessTime = CDate("February 12, 1969") dir1.LastWriteTime = CDate("February 12, 1969") Debug.WriteLine(dir1.CreationTime) Debug.WriteLine(dir1.LastAccessTime) Debug.WriteLine(dir1.LastWriteTime) 'The above three lines prints 2/12/1969 12:00:00 AM End Sub
Thanks for your help. I want to change the modified time not create time.Quote:
Originally Posted by VBDT
I don't get it what is the problem? I can change the creation time of folders in my computer by this.
It works fine for date like "February 12, 2000"Quote:
Originally Posted by cssriraman
The problem is solved now.
Thanks all for your help
if you don't specify the time in your date it will take the defualt value of 12:00:00 AM.