03-21-2023 10:01 AM
I am using an instrument to continuously monitors a process. Each measurement cycle saves a .csv file to a subdirectory within the experiment folder. I am not sure how to access each subdirectory and read the .csv file (all with the filename "integration.csv") as it is being generated by the instrument. Is this possible? I have attached an image of an example file structure and data that is generated from the instrument.
03-21-2023 10:08 AM
Are the subfolders unique?
Also do you want know when the file gets saved automatically?
03-21-2023 10:17 AM - edited 03-21-2023 10:21 AM
03-21-2023 01:13 PM
Thank you, Raphschru. This works perfect for when all of the folders already exist and a script is run. How would you get the VI to wait on a folder to be created by the instrument before it read the .csv file? For example, I plan to start the experiment and VI at the same time. The instrument will create a new folder every 1-2 min, which I would like read as a spreadsheet.
03-21-2023 01:24 PM
Yes, all of the subfolders are unique, starting from 0000 and increase by 1 integer for each data point (0001, 0002, etc.).
It seems like the most straight forward way to do this isfor the program to look for an every increasing folder number and only proceeding if the folder exist. What is the easiest way to implement this? Through a flat sequence?
Thanks for your feedback.
03-21-2023 02:27 PM
Since all of the folders (and files) are unique (despite having the same or very similar names), the following seems (to me) the logical way to do things:
Use "List Folders" on the folder holding all the sub-Folders. Parse the name(s) of the Folders to get the one with the highest numerical value. Now "List Folders" on that "highest" folder. If it doesn't have any files, wait 2 minutes and try again.
Now the only thing you need to think about is the relative timing of folder and file-content creation. Suppose there's a file in the folder -- is it the "latest one", or could it be "left over from yesterday"? You could simply use the File/Directory Info and get the Last Mod data for the file and compare it with the current time to see how long ago it was written.
Bob Schor