Results 1 to 7 of 7

Thread: [RESOLVED] [2003] Change Date of a folder

  1. #1

    Thread Starter
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Resolved [RESOLVED] [2003] Change Date of a folder

    Hi,

    How can I change/set Modified date of a folder?

    Please help
    CS

  2. #2
    PowerPoster VBDT's Avatar
    Join Date
    Sep 2005
    Location
    CA - USA
    Posts
    2,922

    Re: [2003] Change Date of a folder

    try this
    VB Code:
    1. Dim d As DirectoryInfo
    2.         d = New DirectoryInfo(My.Computer.FileSystem.SpecialDirectories.Desktop & "\your Folder")
    3.         d.CreationTime = Now

  3. #3

    Thread Starter
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: [2003] Change Date of a folder

    I tried this:
    VB Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, _
    2.       ByVal e As System.EventArgs) Handles Button1.Click
    3.         Dim dir1 As New DirectoryInfo("C:\Temp\Word8.0")
    4.         dir1.CreationTime = CDate("February 12, 1969")
    5.         dir1.LastAccessTime = CDate("February 12, 1969")
    6.         dir1.LastWriteTime = CDate("February 12, 1969")
    7.         Debug.WriteLine(dir1.CreationTime)
    8.         Debug.WriteLine(dir1.LastAccessTime)
    9.         Debug.WriteLine(dir1.LastWriteTime)
    10.         'The above three lines prints 2/12/1969 12:00:00 AM
    11.     End Sub
    But the modified date for that particular folder is not showing in Windows explorer. Not sure why?
    CS

  4. #4

    Thread Starter
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: [2003] Change Date of a folder

    Quote Originally Posted by VBDT
    try this
    VB Code:
    1. Dim d As DirectoryInfo
    2.         d = New DirectoryInfo(My.Computer.FileSystem.SpecialDirectories.Desktop & "\your Folder")
    3.         d.CreationTime = Now
    Thanks for your help. I want to change the modified time not create time.
    CS

  5. #5
    PowerPoster VBDT's Avatar
    Join Date
    Sep 2005
    Location
    CA - USA
    Posts
    2,922

    Re: [2003] Change Date of a folder

    I don't get it what is the problem? I can change the creation time of folders in my computer by this.

  6. #6

    Thread Starter
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: [2003] Change Date of a folder

    Quote Originally Posted by cssriraman
    I tried this:
    VB Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, _
    2.       ByVal e As System.EventArgs) Handles Button1.Click
    3.         Dim dir1 As New DirectoryInfo("C:\Temp\Word8.0")
    4.         dir1.CreationTime = CDate("February 12, 1969")
    5.         dir1.LastAccessTime = CDate("February 12, 1969")
    6.         dir1.LastWriteTime = CDate("February 12, 1969")
    7.         Debug.WriteLine(dir1.CreationTime)
    8.         Debug.WriteLine(dir1.LastAccessTime)
    9.         Debug.WriteLine(dir1.LastWriteTime)
    10.         'The above three lines prints 2/12/1969 12:00:00 AM
    11.     End Sub
    But the modified date for that particular folder is not showing in Windows explorer. Not sure why?
    It works fine for date like "February 12, 2000"

    The problem is solved now.

    Thanks all for your help
    CS

  7. #7
    PowerPoster VBDT's Avatar
    Join Date
    Sep 2005
    Location
    CA - USA
    Posts
    2,922

    Re: [RESOLVED] [2003] Change Date of a folder

    if you don't specify the time in your date it will take the defualt value of 12:00:00 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width