Anyone monitiored a directory for updated files
Blitz3D Forums/Blitz3D Programming/Anyone monitiored a directory for updated files
| ||
And then taken some action with respect to the updated files ?? Just wondering... |
| ||
Er... What? |
| ||
Not in blitz, but yes. What do you want to do? |
| ||
you could do this pretty easily. Just create a type structure, that holds file name + byte size.. even crc if you want to. Just record the folder info once, then on your own timing interval compare the folder to the initial recorded data and return changes made //PSUEDO CODE Type FolderData field filename$ field size field crc end type Type FolderChanges field filename$ field size field crc end type Function GetfodlerData(path$) ;run through the files and record them into the type list end function Function CompareFolder(path$) ;run though each file and compare to the stored list ;if it doesnt match then record then record it into folder changes ;once you act on this list you may want to delete it before comparing again end function Last edited 2011 |
| ||
Blitzplus is better for this than blitz3d since blitz3d hogs the CPU pretty badly..blitzplus has an event system which is more suited to this sort of thing. Not sure about blitzmax as I haven't used it but I'd guess it would be similar to blitzplus? What RifRaf suggests should be fine. However, I'm not sure how many files you are talking about but blitz can be slow at reading through directories. |
| ||
You'd probably want to use fastpointer for this in B3D and have a thread running every now and again checking this stuff - tho might be some minor issues signalling changes back to the main thread, it would be better to use the modified timestamp on the file rather than filesize. |