07-24-2018 01:05 PM
I need to build a path to folders based on some acquired information, some constant information, and some information that will change with the acquired information. Have I confused you yet? Let me give you an example.
I have a constant folder: S:\Folder1\Code1
I have information that is being acquired: 123.456.789\987.654.321-01 (to be concatenated to the constant)
I have "unknown" information (I know what it is but the names do change): 456.567.009\aFileName.txt
This last piece I need help with. Is there a way to just say open whatever folder and file are in "this" folder?
"This" being the last folder name that is acquired: 987.654.321-01.
Overall I need the path to be:
S:\Folder1\Code1\123.456.789\987.654.321-01\456.567.009\aFileName.txt
Would be very happy to have someone point in the correct direction for this.
Solved! Go to Solution.
07-24-2018 01:19 PM
In order to get all the files in a folder (even if they are below another folder) you will have to recursively find the filenames. Here is an example of how to do that:
07-24-2018 01:25 PM
I am so sorry. I forgot to mention I am using LabVIEW 2012. I was unable to open your example.
07-24-2018 01:38 PM
Recursive Get Files (2012).vi Attached
07-24-2018 01:46 PM
Thank you that was exactly what I was looking for. Where did the "recursive get files" come from you have? In the 2012 search I found Recursive File List.vi. I would think it is similar, but due to it looking different I want to make sure before assuming it is.
07-24-2018 01:53 PM
@Jessica_2067 wrote:
I need to build a path to folders based on some acquired information, some constant information, and some information that will change with the acquired information. Have I confused you yet? Let me give you an example.
I have a constant folder: S:\Folder1\Code1
I have information that is being acquired: 123.456.789\987.654.321-01 (to be concatenated to the constant)
I have "unknown" information (I know what it is but the names do change): 456.567.009\aFileName.txt
This last piece I need help with. Is there a way to just say open whatever folder and file are in "this" folder?
"This" being the last folder name that is acquired: 987.654.321-01.
Overall I need the path to be:
S:\Folder1\Code1\123.456.789\987.654.321-01\456.567.009\aFileName.txt
Would be very happy to have someone point in the correct direction for this.
Constant Folder: S:\Folder1\Code1
Known Sub-Folder: 123.456.789\987.654.321-01
Newly-created Folder and File: 456.567.009\aFileName.txt
Here is how you can use Folder Constants (useful for storing ... Folder Constants), Build Path, Strip Path, and List Folder to build up a path to the "New Folder" (456.567.009) and get a list of all the Files and Folders inside that Folder.
All of these functions (I think) have been around since I started using LabVIEW, with LabVIEW 7 (my only "unsure" is L01 ist Folder). Open your LabVIEW 12 and find these functions on the F I/O Palette (you may need to look in some sub-Palettes).
I would strongly urge you to not use file and folder names such as 123.456.789. They are extremely non-mnemonic! I have a colleague who likes to name files and folders according to date and time -- talk about tedious, hard to read, hard to parse. I recommend something like the following:
Bob Schor
07-24-2018 02:11 PM
The folder naming structure is a standard of sorts. The numbers I used were for an example, the real folder numbers make more sense. The last folder and file are within the constant/ acquired folders that I need to be found for use in another section of the overall program.
The information that has been provided has been very helpful and I have more extras to look into and learn about.
Format Into String is something I would very much like to have more details on. It seems there are things you can do with it that the help area does not go into detailed enough for me. Especially when I see some other examples in the forum.
I have been trying to figure out the best way to find the needed text file while keeping standards. I am still learning about the extra functions that LabVIEW has to offer and how to manipulate what was shown in the tutorials to fit my needs. Still new with this, but am managing to figure things out looking through this forum, LabVIEW help, and trying things. All help is appreciated.
07-24-2018 02:53 PM
The one I sent you, I just coded up. The function calls itself, that's why you don't need an extra "SubVI" to go with it, it is its own SubVI!
Good find on the Recursive File List! I forgot that NI ships this function already, haha, use that one!