May 21, 2024, 06:57:44 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Retrieving directory creation & last written times.

Started by Egil, March 23, 2016, 04:04:43 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Egil

Does anyone know how to retrieve the date and time when a directory was created and when it was last written to?

Support Amateur Radio  -  Have a ham  for dinner!

Andy

Egil,

I think the GetFileTime function should work.

DECLARE IMPORT,GetFileTime(handle:INT,creation:filetime,access:filetime,writet:filetime), INT

Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Egil

Thanks Andy!

I've used that function for doing the same with files, with a slightly modified version of the file filetime.iwb that came with the IWB examples. So will try to see if the folder data also can be retrieved in the same way.
Support Amateur Radio  -  Have a ham  for dinner!

Andy

Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Egil

Andy,

Got exactly the same challenge here as in the link you supplied. The only difference is the mumber of files. My old time radio recordings collection now has around 25000 mp3 files in 1300 directories. So really need to make a program that makes it possible fo find specific files in an easy way.

Have been playing around with the functions mentioned in that thread all morning here, but begin to think that all that functions were all made for the FAT and FAT32 file systems and that all do not work properly with the NTFS system. Getting some weird results here, so probably doing something wrong.
There is also an new file system I think will be more often used in the future, the ReFS (made for Windows 8 servers), but this one have to wait until I have decided to go on with windows or not.

But taking a break now. The house is full of grandchildren, and we have planned to walk along the beaches for our annual easter family photo contest...
Support Amateur Radio  -  Have a ham  for dinner!

LarryMc

Remember this:
Not all file systems can record creation and last access times and not all file systems record them in the same manner. For example, on FAT, create time has a resolution of 10 milliseconds, write time has a resolution of 2 seconds, and access time has a resolution of 1 day (really, the access date). Therefore, the GetFileTime function may not return the same file time information set using the SetFileTime function.
NTFS delays updates to the last access time for a file by up to one hour after the last access. NTFS also permits last access time updates to be disabled. Last access time is not updated on NTFS volumes by default.
Windows Server 2003 and Windows XP:  Last access time is updated on NTFS volumes by default.


There is other info in this  article that is helpful
https://msdn.microsoft.com/en-us/library/ms724290.aspx
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Egil

Thanks for the nice link Larry!

QuoteNTFS delays updates to the last access time for a file by up to one hour after the last access. NTFS also permits last access time updates to be disabled. Last access time is not updated on NTFS volumes by default.

Well, I got two NTFS disks on this pc. Windows Explorer is able to report both creation times and last updated times with one second accuracy. That is good enough for my application. And since it is done by windows Explorer, I am convinced that it will be possible to do the same with a home brew program coded with any of the IWB languages.

Guess the best way to solve my problem is to browse the include files to see how the structures for file and folders are defined. When I find the correct structure the rest ought to be relatively easy....
Not sure, but think that Allan Nuss once posted code that could do that kind of browsing automaticly, so have to search the forum to see if I can find it.
Support Amateur Radio  -  Have a ham  for dinner!