LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

reading the folder

HI 

I am trying to open a folder which contain many folder so I would like to select the folder that I need and get the final text file ,, so I tryed with this program but it's not function 

can you help me  please .

 

0 Kudos
Message 1 of 32
(2,899 Views)

Why are you concatenating spaces to the beginning of many of your strings?

 

You should also be using Build Path rather than strings and concatenation to actually build the paths.

0 Kudos
Message 2 of 32
(2,877 Views)

Since you have a repeating pattern, perhaps you should be using a FOR loop.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 32
(2,822 Views)

I think the reason the code isn't working is that it is doing what you told it to do, not what (I think) you want it to do.  I don't know how you've named your Folders, but I'm assuming that if you have a Control called "année", a reasonable folder name might be "2018".  But if you set the Year Control to 2018, it is going to try to return the 2019th folder name, probably not what you want.

 

This entire VI looks like an example of "throw down some code first, think later".  Try reversing the order.

  • What is the Folder Structure you are examining?  How are they named?  How are they nested?
  • Is the ultimate name made up of concatenated parts?  If so, you should consider "building the concatenated name" in a single step.  I like to use "Format into String" for this, as it is very easy to get it to format something like "2018, 12-25.txt".

Bob Schor

0 Kudos
Message 4 of 32
(2,807 Views)

HI

actually I am trying to read a txt file . 
so the repertoire I have a folder which contain many other folders have the name of the year " 2007,2008 2009 2010 ...." and which year folder have twelve folders which are the months of the year so "01,02,03,04....12"  and which folder have folders for the days and finally which day have a  txt file that I need to read it , 
thank you for your help 
0 Kudos
Message 5 of 32
(2,784 Views)

I would use Format Into String, with Year, Month, Day, and Filename as inputs.  You could (should?) put checks in to be sure the input parameters "made sense" (i.e. Month was 1..12, and Filename obeyed certain rules, such as "always had extension .txt" or "always had no extension" or "add .txt if no other extension").  For a full path, you might also want to add the path to the Top Level Folder (e.g. C:\Users\Me\My Documents\My Data).

Create Path.png

Bob Schor

0 Kudos
Message 6 of 32
(2,779 Views)

HI

thank you for your reply , but actually I didn't undrestand you how can I put this icon 

thank you 

0 Kudos
Message 7 of 32
(2,772 Views)

re you talking about the "Format Into String" function?  It can be found on the String Palette --

Format into String.png

You drag whatever you want to format into a string into the bottom input, dragging down the bottom edge of the function if you need additional inputs.  The Function will recognized whether you are inputting a number, a string, or whatever.  You can then right-click it and choose "Edit Format String" (the series of characters coming in on the top".  I chose to display Year as a Decimal, Month and Day as 2-digit decimals with leading 0, and the Filename as a String.  To insert the backslash, I just put in a backslash, but since this is a "special character", I needed to "escape" it with another backslash.  You can read more about this function by right-clicking it and choosing Help.

 

Bob Schor

 

0 Kudos
Message 8 of 32
(2,768 Views)

HI 

thank you 

actualy I am thinking to use a property node , but I didn't find it can you help how can I get the item name ,,  actually when I  select create -> property node I didn't find the appropriate property (NomsÉlts {items names}, ..)

 

0 Kudos
Message 9 of 32
(2,765 Views)

I was wondering where Property Nodes came in, then I realized that I probably didn't understand what you really wanted to do.  Let me try again (I'm going to, again, be "guessing", but you can correct me if I'm wrong):

  • You want a "Drop-down" Control that will let you find the Top Level Folder (TLF) that has the "Folder of Years" inside it.
  • Once you have selected this TLF, you want another Drop-down that will allow you to select one of the existing "Year" folders.
  • Next you want to select an existing "Month" folder.
  • Next you want to select an existing "Day" folder.
  • Finally, you want to select an existing .txt file.
  • During this "descent", you don't want to see anything that isn't a "Year", "Month", "Day", or .txt entity.

A Path Control with a Browse Option set to Existing Folders can be used to search for and select the Top Level folder.  For the Year, Month, and Day folders, you can use a Path Control with Browse Option, and use a Property Node to set the Start Path to the previously-found Folder Path.  Note that this will show all Folders, including those that might not be named with 4 or 2 digits.  Finally, you can use a Path Control with Browse Option set to Existing Files, and Pattern set to *.txt, to find the final File, which should return the full Path to that file (which, I think, is what you want).

 

Bob Schor

0 Kudos
Message 10 of 32
(2,755 Views)