April 27, 2024, 03:03:53 AM

News:

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


Searching for old files

Started by mlwhitt, February 16, 2007, 02:32:17 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

mlwhitt

Hello everyone.  This is my first posting here.   I am an old IBasic developer that just came across Paul's new venture.   Glad to find an IBasic compatible language that has support since Mark ran Pyxia into the ground but I digress....   


As far as my question.....

I have a directory that has 999 subdirectories under it.    I am working on an application that will find all the files in each of these subdirectories and compare them with the last time the app ran through for any files that are still the same.     Pretty much what I am doing is that we have a directory with a list of subdirectories that get files added to them on a regular basis.  The files after a few minutes are then transferred to another drive.   If a file remains within a given subdirectory after x number of minutes we can assume that something is wrong with this other application and the program will let us know.

I have gotten this to work half way correctly with EBasic  by going through the directories using the FINDNEXT command.   What I am doing right now is finding any files in the directories, saving them to a file (called current.txt) and then the next time around the program moves current.txt to previous.txt, and creates a new current.txt with what files are currently in the directories and compares them with the old file list by pulling the connects of the current.txt file into an array and the contents of previous.txt into another array and putting any matches within a editbox.

Can anyone think of a easier solution than saving each pass into a file and then reading them back in?   

Thanks.

Bruce Peaslee

I moved a file from one directory to another and the last accessed date and time changed. Try experimenting with that. I am sure there are API calls to get the various file dates.
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

mlwhitt

I got it working fairly well now.  After I was sure I got it working correctly I removed the current.txt and previous.txt out of the picture and just used three arrays  .  One array holds the name of the files found in the directories.  The second array holds the previously found filenames and the third array ends up holding the matching file names between the other two arrays.    Seems to be working pretty smooth now.    One thing that I ended up noticing was that I had placed  FINDCLOSE dir outside of the for..Next loop that stepped through the directories.  After I placed it within the For..next loop the memory usage drastically improved.

LarryMc

Just in case:http://msdn2.microsoft.com/en-us/library/ms724320.aspx

TYPE FILETIME
   DEF dwLowDateTime:INT
   DEF dwHighDateTime:INT
ENDTYPE
DECLARE "kernel32.dll",GetFileTime(hFile:INT, lpCreationTime:FILETIME, lpLastAccessTime:FILETIME, lpLastWriteTime:FILETIME),INT
DECLARE "kernel32.dll",FileTimeToDosDateTime(pFileTime:FILETIME, lpFatDate:INT, lpFatTime:INT),INT
DECLARE "kernel32.dll",FileTimeToSystemTime(pFileTime:FILETIME, lpSystemTime:SYSTEMTIME),INT
DECLARE "kernel32.dll",FileTimeToLocalFileTime(pFileTime:FILETIME, lpLocalFileTime:FILETIME),INT


LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library