Restore file properties (1 Viewer)

jpl458

Well-known member
Local time
Yesterday, 17:24
Joined
Mar 30, 2012
Messages
1,218
When file is created there is a timestamp associated with it, in the files properties, but if you move the file the timestamp is changed to the date and time of the move. Is there any way to recover the original properties of the file, which includes the original date created.
 
I just happened to be looking at a similar issue myself. In my case I'm using a temp database and trying to delete it after a period of time and create a new one in its place. The odd thing is that after deleting and recreating it, it retains the same creation date.

From what I found it's a little difficult to set the created, modified, and accessed dates but I found some code that will do it.

While it does not recover a changed created date, it will allow you to set it to whatever date you want.

In the VBE, go to the file tab and select import files and import these 3 .bas files. The modTest.bas file is just for testing and the other 2 are required.

You can call it with something like:

Code:
Call SetFileDateTime(PathToTheFile, YourDesiredDate, FileDateCreate)

Replace the path and date with what you want. FileDateCreate is the argument to set the created date, as opposed to the modified and accessed dates..
 

Attachments

Last edited:
I just happened to be looking at a similar issue myself. In my case I'm using a temp database and trying to delete it after a period of time and create a new one in its place. The odd thing is that after deleting and recreating it, it retains the same creation date.

From what I found it's a little difficult to set the created, modified, and accessed dates but I found some code that will do it.

While it does not recover a changed created date, it will allow you to set it to whatever date you want.

In the VBE, go to the file tab and select import files and import these 3 .bas files. The modTest.bas file is just for testing and the other 2 are required.

You can call it with something like:

Code:
Call SetFileDateTime(PathToTheFile, YourDesiredDate, FileDateCreate)

Replace the path and date with what you want. FileDateCreate is the argument to set the created date, as opposed to the modified and accessed dates..
My problem is based on a lack of knowledge. In my app all data comes from phone calls. I can get the timestamp from the file and automatically enter it into a data entry type form. The problem was, during some development, I relocated the file, and lo all the dates created were changed to the date that I moved the file. I am not talking about an extraordinary amount of data, maybe 40 records or so. But if I can devine a way to conjure up the original dates then your code will be a huge help.

Thanks
 
Moke, I just found a way to get the original timestamps. The way my app works is that the date and time are logged when a call comes in. I also save every version of the app that I worked on, every time I made a change, I saved the app with a new version number, etc. In those old apps, in the Master File, are the dates and times that were logged prior to me moving the folder, thus I think I can recover most of the files, with the use of that spiffy bit of code you sent to restore the timestamps.

Thanks again.
 
Here is a relevant link:


(The link has a funny name here in the body of my post but when I examine the text of the link, it is pointing to the correct article.)

For better or worse, MS decreed that after a file move, the creation date would change. You have to do a specific type of copy. A backup/restore method should preserve dates, and the ROBOCOPY command appears to also have that ability.

Chip Pearson's site has code that could be used to reset the file's creation date. You can read about it here:


Here is a link to Chip's article on this subject. You can read it and perhaps download stuff, but you will not be able to ask him any questions as Chip has passed away.

 
Here is a relevant link:


(The link has a funny name here in the body of my post but when I examine the text of the link, it is pointing to the correct article.)

For better or worse, MS decreed that after a file move, the creation date would change. You have to do a specific type of copy. A backup/restore method should preserve dates, and the ROBOCOPY command appears to also have that ability.

Chip Pearson's site has code that could be used to reset the file's creation date. You can read about it here:


Here is a link to Chip's article on this subject. You can read it and perhaps download stuff, but you will not be able to ask him any questions as Chip has passed away.

It's Chips code I posted. I should have stated that but the modules all have his info.
 

Users who are viewing this thread

Back
Top Bottom