Is there a function that is the equivalent of FileTimeSet but for directories instead of files?
Doesn't seem like there is but thought I'd ask to be sure.
Thanks! 👍
You can try the following.
; Date to set
Date = ObjectClrNew("System.DateTime", 2001, 1, 1, 8, 0, 15)
; Set the date on the target directory
Dir = ObjectClrNew("System.IO.Directory")
Dir.SetCreationTime("C:\Temp\Trash", Date)
; Make sure that no process is using the directory.
; This includes Windows File Explorer not having a
; window open to it.
I actually need to change the Last Modified date on the directory - but with your example I was able to find the Microsoft Directory Class documentation (https://learn.microsoft.com/en-us/dotnet/api/system.io.directory) online and used the "SetLastWriteTime" method in place of "SetCreationTime" and it works perfectly. :D
Thank you!
Date = ObjectClrNew("System.DateTime", 1999,2,14,9,38,26)
Dir = ObjectClrNew("System.IO.Directory")
Dir.SetLastWriteTime("C:\temp", Date)
Great. You took the initiative and found the solution that best fits your needs.