Load most recent files in a directory
ssmith911
LoadWave/A/O/J/D/W/K=0/V={","," $",0,0}/L={0,1,0,0,0}/R={English,2,2,2,2,"Year-Month-DayOfMonth",40} E:PTI Data:"20180302.130515_PTI.txt"
LoadWave/A/O/J/D/W/K=0/V={","," $",0,0}/L={0,1,0,0,0}/R={English,2,2,2,2,"Year-Month-DayOfMonth",40} E:PTI Data:"20180302.130516_Housekeeping.txt"
LoadWave/A/O/J/D/W/K=0/V={","," $",0,0}/L={0,1,0,0,0}/R={English,2,2,2,2,"Year-Month-DayOfMonth",40} E:PTI Data:"20180302.130516_Housekeeping.txt"
Thanks for the help.
ssmith
You need to add the /P flag to these commands to do this. If you specify a path using
NewPath
you can then use that path with the /P flag. There's several file loaders in code snippets to draw some inspiration but you could have something like:if (V_flag!=0)
DoAlert 0, "Disk folder error"
Return -1
endif
and then you can use /P=diskFolder to load your files with LoadWave.
March 20, 2018 at 03:01 pm - Permalink
According to your example, you are trying to load using a fill path, "E:PTI Data:20180302.130515_PTI.txt". This should load without presenting a dialog. If it does present a dialog, that means that your full path in not correct. The same goes for "E:PTI Data:20180302.130516_Housekeeping.txt".
You should not need it in this case because you have a full path for both files. But in the general case of loading two files in the same directory whose file names are known but whose directory is not known, you can use the S_path output from the first LoadWave to form the parameter for the second LoadWave. For example:
if (V_flag != 0) // The first load succeeded?
String filePath = S_path + "SecondFile.txt" // Generate full path
LoadWave/J filePath
endif
See the help for LoadWave for a discussion of the S_path output variable.
sjr51's technique of using a symbolic path would also work. To learn about symbolic paths, execute:
DisplayHelpTopic "Symbolic Paths"
March 20, 2018 at 05:38 pm - Permalink
LoadWave/A/O/J/D/W/K=0/V={","," $",0,0}/L={0,1,0,0,0}/R={English,2,2,2,2,"Year-Month-DayOfMonth",40} "E:PTI Data:20180302.130516_Housekeeping.txt"
Correct, this does not present a dialog. The filename is generated using using date and time. So the path is known but the filename is not. So I want to load the most recent *PTI.txt and the *Housekeeping.txt files in the E:PTI Data: directory. Thanks for the help
ssmith911
March 21, 2018 at 05:57 am - Permalink
This could be done with a fair amount of work. You would have to get a list of all ".txt" files, using IndexedFile. You would then have to get the modification date for each file, using GetFileFolderInfo. To start, see the DemoIndexedFile example function in the help for IndexedFile.
For another approach, choose File->Example Experiments->Programming->Watch Folder.
March 21, 2018 at 08:53 am - Permalink