Search the Community
Showing results for tags 'multiple files'.
Found 2 results
Hello, So this may be more of a challenge of effective programming then specific to AutoIT but I want to solve this problem with AutoIT so i'm putting it here. (If someone has a better language to solve with I'm all ears) So the task I'm trying to achieve is that I have multiple .CSV files that have: year, month, day, hour, value. I need to be able to sum up all the values that have the same date/time, then find which date and time has the maximum value. The problem is that each file may or may not have same amount of days/hours as the rest. So I need to devise a way to handle this. Example: File A File B File C 2018 1 1 1:00 10 2018 1 1 2:00 10 2018 1 1 1:00 10 2018 1 1 2:00 12 2018 1 1 3:00 12 2018 1 2 1:00 12 2018 1 1 3:00 14 2018 1 1 4:00 14 2018 2 1 1:00 16 2018 2 1 1:00 16 2018 2 1 1:00 16 Answer I want to be spit out is Feb 1st 2018 at 2:00 with value of 48 So far I've got code to store all .CSV files to an array, then a loop to go through each csv, but not sure how to effectively manipulate the data. Keep in mind each file has over 7000 time entry points. If anyone can solve this that would be pretty awesome! #include <Array.au3> #include <File.au3> #include <MsgBoxConstants.au3> RefineData() Func RefineData() Local $i, $filenum, $file, $csvArray, $FilePath = @ScriptDir $fileList = _FileListToArrayRec($FilePath, "*.csv", 1) ;Create and array of all .csv files within folder Local $chkArray[UBound($fileList)] ;=====Loop through the .csv files within the folder====== For $filenum = 1 To UBound($fileList) - 1 Step 1 $file = $fileList[$filenum] $sFilePath = $FilePath & "\" & $file ;=====Create array based on csv file===== _FileReadToArray($sFilePath, $csvArray, $FRTA_NOCOUNT, ",") ;#### Operations here ###### next msgbox(0,"", "Date: " & $date_of_max & "Value: " & $maxVal );display solution endfunc
Here is the sample of the content of a file(s):- string1 strin2 other-string some-other-string foo=bar string(n) I used _FileListToArrayEx to list all the files with specific extension. Now i am removing specific strings which are not required. I used _ReplaceStringInFile to delete specific string. Hoever i am struck while deleting the string "foo=bar" where "foo=" is common in some of the files and bar can be anything else. So my requirement is to either delete entire foo=bar or delete anything after foo= till white space is reached or insert some-static-string after foo= Any help is appriciated.