LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Create Folder function won't work...

Solved!
Go to solution

So, I might be looking at this too simply, but what I have hear is just a Create Folder function that has a folder path, with variable characters in it, attached to that function.

 

It actually seems to work a little because folders are made, one successfully inside the other inside the other, etc. But the folders' names aren't what I want. I want parent folder as the Year, first child folder the Month, and the second the day. And I tried to do this with those characters %Y, %d, and %m, as such. But I'm not sufficiently learned with that syntax.

 

Finally, when I run the code I get Error 10: Duplicate Path, but I have yet to solve that one. Attached here is an example file.

0 Kudos
Message 1 of 8
(4,460 Views)
Solution
Accepted by topic author ShogunOrta

Thanks for including code -- I can clearly see what you want to do, but (as you already found out) you can't do it that way!

 

Do you know about the file functions Build Path and Strip Path?  Build combines a Path and a String into a Path, and Strip splits out the last part (which is usually the File Name) as a String.

 

So what you need to do is get Year, Month, and Day as numbers or as strings.  Let's say you have them as numbers, and want to build a folder structure that looks like \<Year>\<Month>\<Day>.  Here's another wonderful function -- Format into String, and here it is in action:

Paths.png

You see the Year, Month, and Day pass into Format Into String.  It has a "Format String" that would default to "%d %d %d" (three numbers separated by spaces), but I replaced the spaces by a backslash (which needs to be put in the Format String as two backslashes -- read the Help for an explanation).  I then do a Build Path to create the Folder (note I don't need a backslash separating Path from "file", though this isn't a file, it's more of the path) and then add the Filename on with another Build.

 

You can learn more about these functions by simply trying them out.  Drop them on a Block Diagram, right-click them and ask for Help, read the Help description, then write a little code to see if you can make it work for you.

 

Bob Schor

 

 

0 Kudos
Message 2 of 8
(4,443 Views)

I think you should take some free LabVIEW training.  The software is doing exactly what you asked, create a directory named %Y many thousands of times a second with no way to stop it.  What you likely want is to create the folder that needs to be made by using the timing functions.  Using this along with format into string and build path you should be able to make a folder with the format you want.  But again I'd start with the training:

 

Here are some free training links if you are interested:

 

NI Learning Center

NI Getting Started

-Hardware Basics

-MyRIO Project Essentials Guide (lots of good simple circuits with links to youtube demonstrations)

-LabVEW Basics

-DAQ Application Tutorials

-cRIO Developer's Guide 

Learn NI Training Resource Videos

6 Hour LabVIEW Introduction
Self Paced training for students
Self Paced training beginner to advanced, SSP Required

0 Kudos
Message 3 of 8
(4,443 Views)

This did great! I went a different route and had the date displayed as a string time stamp. Then I concatonated '\' onto the ends of each part of the date. And then fed that into the Format string, and then the build path. And from there attached that to the Create Folder. And Vuelah! It worked! Thanks again.

0 Kudos
Message 4 of 8
(4,415 Views)

@ShogunOrta wrote:

And Vuelah! It worked! 


Is that supposed to be Voilà?  [If it is not supposed to be French, I'm curious what language it is ...].

 

Bob Schor

Message 5 of 8
(4,392 Views)

@Bob_Schor wrote:

@ShogunOrta wrote:

And Vuelah! It worked! 


Is that supposed to be Voilà?  [If it is not supposed to be French, I'm curious what language it is ...].

 

Bob Schor


Bob, I think your inner ear is calling you.  😉



Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 6 of 8
(4,385 Views)

If starting from a time stamp, I recommend this:



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 7 of 8
(4,340 Views)

Yep, I ended up doing something to that effect. It works fine! Thanks, guys.

0 Kudos
Message 8 of 8
(4,317 Views)