File info
Blitz3D Forums/Blitz3D Beginners Area/File info
| ||
I am trying to write an updater program. However I need to know info regarding a file, such as its filename, filesize and date and time it was written, but I cant find ou how to get this info. Can anyone please help? TIA Z |
| ||
FileSize(file$) gets the size of the file "file". ReadDir(path$) opens a directory so that you can use NextFile(dir) to read out the files of the directory. MoreFiles(dir) returns True if there are more files in directory "dir" that can be read with nextfile(). FileType(file) returns "0" if it doesn't extist and you can check if a file read with NextFile() is a dir or a file. In case its a file filetype() returns "1", if it is a dir "2" is returned. this dir can then be read with ReadDir()... Raitsun |
| ||
This was not very clear, i know... just watch this:dir=READDIR("C:\") REPEAT file$=NEXTFILE$(dir) IF file$= THEN EXIT IF FILETYPE("C:\"+file$) = 2 THEN PRINT "directory:" + file$ ELSE PRINT "file:" + file$ END IF FOREVER CLOSEDIR dir PRINT PRINT "-end-" For Info like date and time the file is written, or something like that, you need a userlib. Search the code archives "user libs" espeacially th ones using windows DLL's and look for the functions you need. Raitsun |