LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Verify and create folder if not exist

Hello everyone
i'm doing an internship and i need help with labview programming. i'd like some help. the subject is that i've created a array containing data from an excel file in one column and the second column contains the worksheet to which the data belongs. then i've created a list of folders in a array using the list folder function. these folders have the same names as the data. the problem is that i'd like to compare the two, list folder and column 1 which contains the data and see if it exists i'd like it to be moved to a folder containing the name of the excel tab if not i'll create it.

0 Kudos
Message 1 of 4
(145 Views)

It sounds like you need a For loop, Search 1D array and Check if file/folder exists. 🙂

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 2 of 4
(127 Views)

@AymenDZdouar wrote:

Hello everyone
i'm doing an internship and i need help with labview programming. i'd like some help. the subject is that i've created a array containing data from an excel file in one column and the second column contains the worksheet to which the data belongs. then i've created a list of folders in a array using the list folder function. these folders have the same names as the data. the problem is that i'd like to compare the two, list folder and column 1 which contains the data and see if it exists i'd like it to be moved to a folder containing the name of the excel tab if not i'll create it.


Alternatively, simply call Create Folder on all folders, without checking first.

 

Create Folder will create an error if the folder exists, but who cares? You might actually care, this is somewhat of a hack, but a hack this convenient is acceptable in my book if the pay off is high (you get less code).

 

After the Create Folder, you know the folder is there (old or new), so you can copy your files...

 

Create Folder Function - NI

Message 3 of 4
(99 Views)

wiebe@CARYA wrote:

Create Folder will create an error if the folder exists, but who cares? You might actually care, this is somewhat of a hack, but a hack this convenient is acceptable in my book if the pay off is high (you get less code).


The exact error is error code 10, whose description is "Duplicate Path".  In my reuse library, I just create the folder and use Clear Error to ignore code 10.  As you said, if I try to create a folder that already exists, I do not care 99.9% of the time.


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
Message 4 of 4
(86 Views)