Jump to content

Recommended Posts

Posted

Am I correct in assuming AutoIt cannot alter the creation timestamp of a windows file for security reasons?  i'm trying to FileCopy (and rename) thousands of spreadsheets to a new directory but I want to keep the file times.  FileSetTime works great for modified and accessed date but not for create date.  If this is a security violation, I suppose I can start over and use robocopy or something.

Posted (edited)
1 hour ago, jaja714 said:

Am I correct in assuming AutoIt cannot alter the creation timestamp of a windows file for security reasons?

As far as I can tell, No ;). Take a look at _Date_Time_SetFileTime

I copied a file to another directory and was able to restore the original creation timestamp.

Edited by Musashi
typo

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Posted

Unfortunately, _Date_Time_SetFileTime, needs a filehandle and, since I already copied the files not knowing about this alternate version of FileSetTime_Date_Time_SetFileTime does not seem to be an option for me.

Posted (edited)

FileSetTime, with $FT_CREATED, sets the create date just fine on my machine.  I just tested it on a Win7 box.  So if it doesn't work for you, then maybe there's an issue in your environment or your implementation.  Since you haven't shown the relevant code that you are using, it's REALLY hard to know why it may not be working for you.

Edited by TheXman
Posted
27 minutes ago, TheXman said:

FileSetTime, with $FT_CREATED, sets the create date just fine on my machine.

Yes, I can confirm that (for the sake of completeness only :) ). It is also easier to handle compared to _Date_Time_SetFileTime.

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Posted
44 minutes ago, jaja714 said:

Unfortunately, _Date_Time_SetFileTime, needs a filehandle ...

To get the handle(s) of the respective file(s) you can use _WinAPI_CreateFile . The function name (...CreateFile) is a bit misleading, because with the parameter $iCreation=2 an already existing file can be opened. By using the parameter $iAccess=4 the timestamps can be inserted.

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...