Zithen Posted July 13, 2005 Share Posted July 13, 2005 looking to see how to do the following: have a script that pulls thourgh a buch of text files pulls some information out into a .csv file. unfortently i cant just move the files after i have read them, they have to stay where they are. is there/how can i make it so that it can check to see if that file has been read already so not to reread the file and reenter the data? Link to comment Share on other sites More sharing options...
Zithen Posted July 13, 2005 Author Share Posted July 13, 2005 wanted to give a little more information on the csv file. it pulls 2 things from the file ipaddress and username, and gets computer name from the filename with a trim to cut .txt off since thats how it saves and looks like this computername,ipaddress,username Link to comment Share on other sites More sharing options...
LxP Posted July 13, 2005 Share Posted July 13, 2005 You could read the names of the files into an array and then process each element of that array. Because each name would only occur once, you would never read any file twice. Link to comment Share on other sites More sharing options...
blindwig Posted July 13, 2005 Share Posted July 13, 2005 looking to see how to do the following:have a script that pulls thourgh a buch of text files pulls some information out into a .csv file. unfortently i cant just move the files after i have read them, they have to stay where they are. is there/how can i make it so that it can check to see if that file has been read already so not to reread the file and reenter the data?<{POST_SNAPBACK}>How do you get the list of files to be processed? FileFindNextFile will never return the same file on a single search handle. My UDF Threads:Pseudo-Hash: Binary Trees, Flat TablesFiles: Filter by Attribute, Tree List, Recursive Find, Recursive Folders Size, exported to XMLArrays: Nested, Pull Common Elements, Display 2dSystem: Expand Environment Strings, List Drives, List USB DrivesMisc: Multi-Layer Progress Bars, Binary FlagsStrings: Find Char(s) in String, Find String in SetOther UDF Threads I Participated:Base64 Conversions Link to comment Share on other sites More sharing options...
Zithen Posted July 13, 2005 Author Share Posted July 13, 2005 i really need to think more clearly when i post things i left out the main part.... and i can get it to read the files all fine, but this is the part i missed, there are new files that will be comming in so i will need to run the script agine to get the infomration off the new files, currently if i rerun the script it will add all the files agine, i just want to get the stuff off the new files and skip the ones that were read before. Link to comment Share on other sites More sharing options...
Valuater Posted July 13, 2005 Share Posted July 13, 2005 maybe this could help... we utilized the "date" of the file in a similar search processhttp://www.autoitscript.com/forum/index.php?showtopic=13255#hope it helps8) Link to comment Share on other sites More sharing options...
LxP Posted July 14, 2005 Share Posted July 14, 2005 Alternatively you could use the registry, an INI file or even just a plain text file to keep track of the files that have been processed. A plain text file would probably be best for the job because it would be easiest to manipulate. All you would need to do is search this list file for the name of the file to be processed, and if the file isn't listed then process it and append the name of that file to the end of the list. Link to comment Share on other sites More sharing options...
blindwig Posted July 14, 2005 Share Posted July 14, 2005 Alternatively you could use the registry, an INI file or even just a plain text file to keep track of the files that have been processed. A plain text file would probably be best for the job because it would be easiest to manipulate.All you would need to do is search this list file for the name of the file to be processed, and if the file isn't listed then process it and append the name of that file to the end of the list.<{POST_SNAPBACK}>If you went this route, you could use my binary trees UDF to quickly keep a list of which files are done, and check to see if you've hit a file already or not.I think it would be easier to write a function that would store the time/date in a global variable, then loop through all the files. If the file date is newer than the last time the function ran, then obviously it's a new file.There are also ways (through DLL calls) to set a hook into a directory that you can check to see if any file has changed, but I don't know the calls off-hand. My UDF Threads:Pseudo-Hash: Binary Trees, Flat TablesFiles: Filter by Attribute, Tree List, Recursive Find, Recursive Folders Size, exported to XMLArrays: Nested, Pull Common Elements, Display 2dSystem: Expand Environment Strings, List Drives, List USB DrivesMisc: Multi-Layer Progress Bars, Binary FlagsStrings: Find Char(s) in String, Find String in SetOther UDF Threads I Participated:Base64 Conversions Link to comment Share on other sites More sharing options...
trids Posted July 14, 2005 Share Posted July 14, 2005 How about using FileSetAttrib to mark the files you've processed?Or even better .. you can setup an INI file, where the file names that you process form the parameter-names: at first, the INI is empty, and when you read your first file, you check the INI to see if it's there .. which it isn't, as indicated by the default value from IniRead. So you process it, and then use IniWrite to add the filename as a parameter to the INI file. If you set the parameter values equal to the date and time of using the IniWrite, then you get extra statistical value from the INI file .. for free Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now