|
You need to do such as:
BOOL change_dir_timestamp(TCHAR* DirName,const FILETIME&ftCreationTime,const FILETIME&ftLastAccessTime, const FILETIME&ftLastWriteTime)
{
HANDLE hDir = CreateFile(
DirName,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_DELETE,NULL,OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS,
NULL);
if (hDir ==INVALID_HANDLE_VALUE )
return FALSE;
BOOL retval = SetFileTime(
hDir, &ftCreationTime,&ftLastAccessTime,&ftLastWriteTime);
CloseHandle(hDir);
return retval;
}
ChinTse Wu[^.^]
|
|
|
|
|
But it shows the poorness of the design of the full time stamp system - that I think inherited from DOS...
Timestamps on files should be GMT times, converted to local time only when the they need to be displayed.
And your tool should be unnecessary...
Alas, thank you for it!
Pierre Couderc
|
|
|
|
|
Not sure if this has been mentioned before...
There is an excellent Shell Extension available for Win95/98/nt4/2k/xp, called "Properties Plus 1.65", available at http://www.ne.jp/asahi/cool/kish/pplusmain.htm.
PropertiesPlus is a free add-on for your Windows Explorer.
It adds additional functionality to your right-click menu under the menu option PropertiesPlus.
Here you'll be able to modify file attributes, file extensions, and the time stamps of single files, multiple files, or files contained within the folders. Display the bytes allocated.
Give it a look, been using it for quite a long time, it's one of those system programs that I always install on a new system, it's just that handy!
|
|
|
|
|
Well, while we are on the topic of favorite closed source freewares, for this purpose, I use Date/Time Shell Extension, that can be found at http://space.dolphin.free.fr/Windows/main.html
It has numerous options, can change Creation and Modified time/date, etc.
Check out also his Folder Size Shell Extension...
Well, if you look around, you can also find other freewares for this purpose. Now, Chris' approach is original because it uses a time offset, not an absolute one. And we get the source...
|
|
|
|
|
Gurus,
Let me preface this by saying that I'm not a programmer. I was doing a search to find the tools available to change the timestamp on a file/folder.....
My question is, "Is it possible to tell if a file has had its timestamp tampered, perhaps by using one of the available utilities?" This question is asked from a security point of view.
thanks
Kirk
|
|
|
|
|
I didn't see this article until after I submitted my own article.
At least my article (http://www.codeproject.com/useritems/touch_win.asp[^]) is a command line tool, so there is at least some difference.
But it really feels like going to a party, to find out you've dressed just like someone else at that party. Can I go home now?
--
If I had the ability to smooth talk like John Simmons, this post would be less sarcastic and more to the point.
|
|
|
|
|
How embarrassing
cheers,
Chris Maunder
|
|
|
|
|
If your users reported a problem in your server program to your manager, you can fixed it quickly (as quickly as Chris Maunder ) and redeploy it after setting the timestamp to that of the previous version. Then you can say to your manager "Problem? What problem?"
|
|
|
|
|
shhhhhhhh
|
|
|
|
|
Ok, so the challenge is now to put it into a Shell Extension
--
Paul
"If you can keep your head when all around you have lost theirs, then you probably haven't understood the seriousness of the situation."
- David Brent, from "The Office"
MS Messenger: paul@oobaloo.co.uk
Sonork: 100.22446
|
|
|
|
|
Paul Ingles wrote:
Ok, so the challenge is now to put it into a Shell Extension
You know in Windows Media Player you can select a bunch of songs, right click and click Edit. Then whatever you type gets entered into the selected field for all of the files. Very handy that (Explorer has it too, but only for the Filename field.)
Nice to have that for the Date field
Paul Watson Bluegrass Cape Town, South Africa Colin Davies wrote:
...can you imagine a John Simmons stalker !
|
|
|
|
|
You may try Michael Dunn's The Complete Idiot's Guide to Writing Shell Extensions - Part V[^].
It's surprising how many goodies can be found at CodeProject
Regards
Thomas
Sonork id: 100.10453 Thömmi
Disclaimer: Because of heavy processing requirements, we are currently using some of your unused brain capacity for backup processing. Please ignore any hallucinations, voices or unusual dreams you may experience. Please avoid concentration-intensive tasks until further notice. Thank you.
|
|
|
|
|
I had spotted that actually, I was going thinking about modifying Chris' code to a shell extension and went straight to Mike's articles. Anyway, I'm still going to give it a go -- I've not done any ATL programming for an extremely long time.
--
Paul
"If you can keep your head when all around you have lost theirs, then you probably haven't understood the seriousness of the situation."
- David Brent, from "The Office"
MS Messenger: paul@oobaloo.co.uk
Sonork: 100.22446
|
|
|
|
|
I've converted the (very) basic functionality of touch into a shell extension. It's extremely simple at the moment, so it doesn't warrant a CodeProject article -- effectively just calls a Win32 API function to set the file's time to now.
Anyway, I've put up the source code on my website, along with a Windows Installer package.
http://www.oobaloo.co.uk/Touch/Touch_src.zip[^]
http://www.oobaloo.co.uk/Touch/TouchSetup.msi[^]
When you right click on a file or selection of files, a new option will appear.
I've got to get on with some proper University work now (shouldn't have done this really ), but I'll try and get around to implementing the same functionality as Chris' utility when I get a chance.
--
Paul
"If you can keep your head when all around you have lost theirs, then you probably haven't understood the seriousness of the situation."
- David Brent, from "The Office"
MS Messenger: paul@oobaloo.co.uk
Sonork: 100.22446
|
|
|
|
|
I've updated the code to include a dialog that allows you to change both the Modified and Created Date/Times:
Screenshot: http://www.oobaloo.co.uk/Touch/v2/Touch_v2.png
VS.NET Project: http://www.oobaloo.co.uk/Touch/v2/Touch_v2_src.zip
Installer: http://www.oobaloo.co.uk/Touch/v2/TouchSetup.msi
Once again, it's pretty bare at the moment and the code is pretty messy to say the least -- I was trying to get something functioning before I cleaned it all up.
If you use it it'd be great to hear from you.
--
Paul
"If you can keep your head when all around you have lost theirs, then you probably haven't understood the seriousness of the situation."
- David Brent, from "The Office"
MS Messenger: paul@oobaloo.co.uk
Sonork: 100.22446
|
|
|
|
|
Thanks.
|
|
|
|
|
Well, that depends on how limp their system is. It wouldn't help you with the time limited stuff I have done....
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
|
Tom Archer wrote:
This was even better than I anticipated as it allows me to work from the current time - file by file. Perfect!
Abd he done this to order!
Regards,
Brian Dela
|
|
|
|
|
|
Don't go there Tom. Just don't go there...
cheers,
Chris Maunder
|
|
|
|
|
Tom Archer wrote:
He's your "full service" kinda programmer!!
As Chris pointed out I don't think you should go there Tom
Regards,
Brian Dela
|
|
|
|
|
Huh? What exactly does "full service" mean to you and Chris. I don't know about the rest of the world, but in the states that's about the highest compliment you can pay someone. What does it mean in Oz and GB?
Cheers,
Tom Archer
Author - Inside C#, Visual C++.NET Bible
|
|
|
|
|
Well, bulls "service" cows. Go from there.
|
|
|
|
|