Get Date Modified?

BlitzPlus Forums/BlitzPlus Programming/Get Date Modified?

turtle1776(Posted 2005) [#1]
Been a while since I've used Blitz so I am a bit rusty.

Is there a way to get the date a given file was last modified in B+? Userlibs are okay.


turtle1776(Posted 2005) [#2]
Well this is far from perfect, but at least a start ...

It appears that you can dump the file names, along with the dates they were last modified, to a text file as follows:
ChangeDir myDirectory$
ExecFile "cmd /c dir >dirList.txt"

Then you open the text file and pull the data you need using ReadLine and such. This is fairly cumbersome and I think it only works in Windows 2000 and above. A userlib would be much better.


Kevin_(Posted 2005) [#3]
http://www.blitzbasic.com/codearcs/codearcs.php?code=684

But I advise you to use an API call rather than the above work-around.

Check out the kernel32.dll below...

http://www.blitzbasic.com/codearcs/codearcs.php?code=1180


turtle1776(Posted 2005) [#4]
Thanks.


turtle1776(Posted 2005) [#5]
I posted a small suggested improvement in your code archive entry.
www.blitzbasic.com/codearcs/codearcs.php?code=684


Kevin_(Posted 2005) [#6]
Good one!


ozak(Posted 2005) [#7]
Definately. The delay 50 was an ugly hack and would most likely fail on many future systems :)


turtle1776(Posted 2005) [#8]
Just added a Windows API version that is more powerful and doesn't rely on DOS. It has 2 main functions, FileDate$ and FileTime$. In addition to file creation time, you can get file last accessed time and file last written time.
www.blitzbasic.com/codearcs/codearcs.php?code=684