From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

error code 10 at create folder

Solved!
Go to solution

i am developing a vi in which i have to create a folder in any drive(e.g D:\dataacquisition) than in data acquisition folder, i have to create date folder and name folder and then we need to create some files e.g patient's information, and like this different files in the name folder, i have shown this in attached vi, now the problem is this that when i run the vi for the first time when no folder has been made it runs ok with no error, but when i again run the vi with different patient name it shows Error code 10 at create folder, i know this error is because the same folder is already present, but the problem is this that when an error comes the new patient's folder is not created, i have tried several things but not able to avoid or remove this error, is there any way to remove this error or if there is any other option of creating folder in LabVIEW.

 

I am attaching the vi.

0 Kudos
Message 1 of 16
(6,291 Views)

There is two ways you can do.

 

You can create the folder along with a time stamp including seconds so that your folders will be new always otherwise before creating the folder check whether it is already created or not. If already created skip the create folder function else create it.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 2 of 16
(6,282 Views)

I'm not really sure what you're asking, since the code is working exactly as it should. That very first Create Folder function will return an error if the folder already exists. This is by design. You clearly need to check to see if that folder exists before you try to create it. You could use the File Dialog function, but that will present a dialog asking you to choose a starting folder.

0 Kudos
Message 3 of 16
(6,281 Views)

Hi

 

Attached is a fix for your issue. you will have to use the 'check folder or file exists' before you create the folders.

Regards
Freelance_LV
TestAutomation Consultant
Message 4 of 16
(6,266 Views)

Knowledge Base

 

Read some documents and KB or search this on NI website. Above link is related with Open/Create/Replace File Function and read operations(2.Create) functions.

Thanks and Regards
Himanshu Goyal | LabVIEW Engineer- Power System Automation
Values that steer us ahead: Passion | Innovation | Ambition | Diligence | Teamwork
It Only gets BETTER!!!
0 Kudos
Message 5 of 16
(6,256 Views)

Thanks to every one, your suggestions helped me in solving my problem, although my problem is solved but i am having some more question

 

To P Anand

There is two ways you can do.

 

You can create the folder along with a time stamp including seconds so that your folders will be new always otherwise before creating the folder check whether it is already created or not. If already created skip the create folder function else create it.

-----
Answer-Thankyou,for your suggestion, I tried Creating folder with timestamp including seconds, but it then shows error 1 which i think is formatting error, and yes the other option works well, by using the check if folder function vi works well.

 

FreeLance V

Thanks your vi works well, but now i am having 1 more question 

 

I have also found 1 more other than check if folder exists by which error 10 is avoided but in that case name should be different, now what i want is when suppose i enter the same name in the suppose i want folder with name 'a' to be created and that folder is already present than what i am trying is that labview should ask weather you want to replace existing folder,or you want to delete,or you want to keep both files, delete and replace is easy to implement but although i am trying but if anyone knows the way that how we can keep both the files than that would be great help.

 

i am attaching the vi which is not complete yet, i am trying to implement some more extra points like keeping both the same files or if i want to replace.

 

0 Kudos
Message 6 of 16
(6,233 Views)
Solution
Accepted by topic author RChoudhary

Hi

 

I had simplified your code a bit.

let us know if need further help

Regards
Freelance_LV
TestAutomation Consultant
Message 7 of 16
(6,226 Views)

Hi

 

any update? did you solve your issue?

Regards
Freelance_LV
TestAutomation Consultant
0 Kudos
Message 8 of 16
(6,198 Views)

To FreelanceLV

Thankyou for your help

yes the error 10 issue is solved now, and your code has helped a lot in reducing  the length and efficiency of my code,your code is working correctly, but it is creating new file in case of replace, i want to create new folder and this is not difficult, i am doing it but i am not getting what your code is doing in case of either replace or keep both, in keep both case what i want it is it should make a new folder with name a1(if already made folder is 'a'),i don't think so it's difficult, your code has already done all the things,i just have to add some extra code in that i am doing this and will soon post the code, and will seek your further suggestion.

 

i also need your suggestion on my original project code(this is one part of the code i am working upon), i am making some changes in that and will then post the code, can i post my code here on this post only or do i need to create new post for that.

0 Kudos
Message 9 of 16
(6,186 Views)

Good to know that your issue is sovled for now.

 

You can mark the post which helped you as the solution.

 

If you have further queires, you can always post on the forums. We are here to help in learning LabVIEW and developing successful applications.

 

If you have a new query, I would suggest you open a new post. That will help you track your queries.

 

If you got a solution to this particular question on the error code 10, close this and mark the solution. 

Regards
Freelance_LV
TestAutomation Consultant
0 Kudos
Message 10 of 16
(6,175 Views)