Get Date Modified?
BlitzPlus Forums/BlitzPlus Programming/Get Date Modified?
| ||
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. |
| ||
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. |
| ||
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 |
| ||
Thanks. |
| ||
I posted a small suggested improvement in your code archive entry. www.blitzbasic.com/codearcs/codearcs.php?code=684 |
| ||
Good one! |
| ||
Definately. The delay 50 was an ugly hack and would most likely fail on many future systems :) |
| ||
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 |