LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

new folder

Dear all,

I have a question about the new folder creation.
In my program, it loops continuouly and it need to save some datas to a file. The name of the files and folders are depended on the real time and date.However, I create a party of program which using to create a new folder and new .xls file for saving datas.The attachment is a photo which let you more understand clearly.

When the program run, the program will create a new folder and save the date into that new folder in a set direction path. At the first loop, It is work and the program can create a new folder in the set path. Based on this is a continuous program (Using while loop) and, this party of program will work it again. However It cannot work at the second loop.

Who can help me to solve this program?? In my design, I would like to design a program which can create a new folder in set direction path where there is not the folder on it. 

Thank you.

KIM
0 Kudos
Message 1 of 30
(3,847 Views)
Hello,
you can not create twice the same folder.
This error is "Duplicate path" ?
Julien GELAY
Tecsup
Technicien BE - Software
0 Kudos
Message 2 of 30
(3,824 Views)
Hello Fiston, thank you for your reply first.

I know that i can't create two time but my program is run continuouly. How can i set it which just run one time?

KIM
0 Kudos
Message 3 of 30
(3,809 Views)

Put the Create Folder in a case statement.  Use a function to see if the folder path is valid.  If true, then do nothing in the True case except wire the paths through.  If false, run the create folder in the False case of the case statement.

And don't forget to wire up the error clusters between functions.



Message Edited by Ravens Fan on 01-18-2008 09:37 AM
Message 4 of 30
(3,798 Views)
 Thank you Ravens Fan's reply.

Because I am a new user of Labview and i am using Labview 7.1, I have tried many times. I still don't clearly to know to design a function which is file path checking. Would you mind giving me some hints? 

Thank you! ^^!

KIM
0 Kudos
Message 5 of 30
(3,791 Views)
Many ways to do things like that. 
 
You could first check if the folder allready exists...   if not, then create new, otherwise not.
There's a 'does file/folder exist' vi in Labview 8.5     I think something like that also exists in previous version.
 
Another approach, is to remember that you created the folder, using a boolean. 
 
Typically, you would put something like this in a for or while loop...   Then you could also just check the index...  only create the folder when the index = 0.
 
 
BTW...   you can create the  year-month-day  string in one go.  
Just make the input string for the 'formate date/time string' as follows: "%Y%m%d" 
0 Kudos
Message 6 of 30
(3,787 Views)
Thank you Anthony 's help.

I also try to use boolean to design this part. Maybe i am using Labview 7.1, the "New directory" function cannot enter any index for check the file is created or not. In the Labview 7.1, I see that there is a function which is called "List directory" and it can list the file name for me but it cannot list folder name. However, i cannot use it to check the file path.

KIM 
0 Kudos
Message 7 of 30
(3,779 Views)
LabVIEW 7.1 didn't have that "file exists?" function. That was introduced in 8.0. In LabVIEW 7 you can either:
  • Use the File/Directory Info function. Wire in the path to the file. If you get an error with a code of 7 it means the file doesn't exist.
  • Get the OpenG File library. It has a "file exists?" VI.
0 Kudos
Message 8 of 30
(3,777 Views)
Thank you ,

That is a very useful and hints for me.

And i still have another question. My program is too long. It need to use long time to run each cyclic which show so slow. Can you speed up it without simply my program?

THANK YOU!

KIM 
0 Kudos
Message 9 of 30
(3,771 Views)
Can't help if you don't show us the program. All you've shown us is a snippet which writes some data to a file...
0 Kudos
Message 10 of 30
(3,765 Views)