10-01-2014 11:23 AM
Hello,
I have created a subvi that searches through a main folder for specific files and adds them to a compressed folder. I have 4 folders I need to create for different types of collected files (.csv and .txt). The naming convention of the files include a subject identifier, task description, and time stamp (most of the time). Here are a few examples:
ABC_30s_narrow_ec_12-23-42-PM_R.csv (multiple with different time stamps)
ABC_30s_narrow_ec_12-23-42-PM_L.csv (multiple with different time stamps)
ABC_sts_arms_12-21-06-PM.csv (multiple with different time stamps)
ABC_Tablet_2_12-26-56-PM.txt (multiple with different time stamps)
ABC_gait.txt
ABC_zero.csv
I have tried using the pattern input of the Recursive File List vi to search for a specific task (e.g. 30s) and move that to a specified compressed folder (e.g. balance). The files are only moved if the "pattern" at the end of the filename. Does the pattern only match the end of the files listed or can I get it to search for the pattern in the middle of the name? And is it possible to search for two patterns (e.g. 30s and zero) and move them to the same folder, without overwriting the compressed file? I would like to figure this out without changing the naming convention too much (predetermined by somebody else).
Thanks in advance,
Anton
Solved! Go to Solution.
10-01-2014 01:46 PM - edited 10-01-2014 01:46 PM
The pattern can apply anywhere in the file name. The help specifically shows how a pattern can apply to the beginning of a filename (*.vi matches all VIs). To match specific text in the middle of the filename, you would need to use a pattern like *text* (with an asterisk both before and after the text you want to match). You can similarly match mutiple patterns with *pattern1*pattern2* .
10-01-2014 02:46 PM
Thanks for the reply nathand.
It almost works with the exception of searching for multiple patterns. I tried using *30s*zero* to search for either files containing 30s or zero in the name but this returns zero files (should be 11 with my test folder). I tried looking in the detailed help for the vi but found no solution. Am I using the asterisks correctly for this instance?
10-01-2014 02:54 PM
Ahh, sorry, I misunderstood what you meant by multiple patterns. What you want is an option or list of alternates, and that's not supported. However you can work around this easily by doing the recursive file list with several different patterns, then concatenating the resulting lists.
10-01-2014 03:17 PM
Thanks!
10-02-2014 01:57 PM
The OpenG List Directory Recursive does support searching on multiple patterns. Otherwise yeah just use the native function multiple times.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
16 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord