|
-
May 14th, 2002, 08:07 AM
#1
Archiving Tool & Preserving Dates...
I am writing an Archiving tool, and I want to preserve the Created and Modified Dates, but not sure how to do it.
I don't really care so much about the Created date, but the modified date needs to be the same.
Any ideas?
-
May 14th, 2002, 01:17 PM
#2
Look at GetFileInformationByHandle. This makes it easy to get the created and last modified times. Writing them is going to be a lot more complicated...
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
May 14th, 2002, 05:04 PM
#3
It's just a simple matter of converting a FileTime structure to a SystemTime structure e.g
Code:
FILETIME lpmod;
SYSTEMTIME st;
LPSTR lpTime;
HANDLE hFile = CreateFile( "MyFile", GENERIC_READ,
FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
if( hFile )
{
GetFileTime(hFile, NULL,NULL,&lpmod);
FileTimeToSystemTime( &lpmod, &st );
wsprintf( lpTime, "%d/%d/%d %d:%d:%d",
st.wMonth, st.wDay, st.wYear, st.wHour, st.wMinute, st.wSecond );
CloseHandle(hFile);
}
MessageBox( hWnd, lpTime, NULL, NULL );
/* lpTime contains the date in the format m/dd/yyyy hh:mm:ss */
-
May 14th, 2002, 05:16 PM
#4
K, cool...
Alright, so I place a file into the archive and store its modified date. What about when I extract the file from the arhive? How can I return the modified date to its original value?
I'm open for any suggestions here....
I took a look at Winzip and it seems to preserve the Modified Date, but the Created Date becomes equal to the Modified Date...
-
May 15th, 2002, 03:39 PM
#5
-
May 15th, 2002, 04:26 PM
#6
haha... seriously?
I figued it would be a lot more difficult than just calling a single function...
Either way... Thank You.
-
May 15th, 2002, 05:05 PM
#7
No problem
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|