LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Crea un file in labview

Solved!
Go to solution

8Buongiorno a tutti.

Sono Nuovo nel ambito labview e mi serve il vostro aiuto gentilmente.

Devo creare un folder con nome che scelgo io  ,poi spostare 3 file da una cartella che si trova in un percorso e inserirla nel file appena creato.

Ogni volta devo fare questa operazione con un folder diverso.

Sono riuscito a creare un  folder e spostare soltantoun file  nel folder predefinita , non con l'ultimo folder che ho creato io, e non  con  i 3 file  

 

Non so cosa manca e come fare.

Grazie

Download All
0 Kudos
Message 1 of 29
(1,184 Views)

You only show us pictures of some code fragments, one with a greedy while loop and one with a top-level event structure. We cannot debug pictures.

 

To get help, you need to attach your VI and explain how you use it, what happens, and what you expect to happen instead.

0 Kudos
Message 2 of 29
(1,172 Views)

Good morning everyone. I am new to labview and need your help kindly. I have to create a folder with a name that I choose, then move 3 files from a folder located in a path and insert it into the newly created file. Every time I have to do this operation with a different folder. I was able to create a folder and only move one file into the default folder, not with the last folder I created, and not with the 3 files I don't know what's missing and how to do it. Thank you

0 Kudos
Message 3 of 29
(1,142 Views)

Hi AM,

 


@A.M.k1984 wrote:

I was able to create a folder and only move one file into the default folder, not with the last folder I created, and not with the 3 files I don't know what's missing and how to do it. Thank you


There is only one Move operation - and it is even missing its target path…

When you want to Move/Copy 3 files then you need to call Move/Copy trice: use a loop to iterate over an array of filenames!

 

Did you read the help for all the functions you use?

 

(Btw. it is quite annoying for seasoned LabVIEW users to see labels above functions. Please make them invisible and use the context help window to read/learn the function names!)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 29
(1,128 Views)

Also, if you have multiple events, you probably want a toplevel loop. I really hope you are not using the "continuous run" button for this!

 

Where do you define the three files? Do they always have the same name?

 

Also:

  • The terminals of latch action booleans need to be inside their event case so they properly reset when the event fires.
  • I probably would NOT label a button with "crea File" to create a folder. Too confusing
  • Your sequence structure is pointless.
  • Why do you need two buttons? Wouldn't it be sufficient to have one button (&event) that creates the folder AND moves the files?
  • Please don't maximize the diagram to the screen!
  • There is no need for all these wire bends!
  • It is not sufficient to check if the folder exists, you also need to make sure it is actually a folder and not a file with that same name.
  • Popup dialogs are typically annoying to the user because they are distracting and block dataflow.
0 Kudos
Message 5 of 29
(1,114 Views)

Thank you , i will try 

0 Kudos
Message 6 of 29
(1,058 Views)

Thank you very much.

I wil try later.

 

0 Kudos
Message 7 of 29
(1,056 Views)

I will explain it in other way :

1 . I want to creat a folder name with SN12345 .

2. I want to move 3 files (.amcd,,aban,.txt) to the folder already created Sn12345.

 

Then I will repeat the operation with other different SN .... but with the same file .

 

Then when i creat the last foldere , i must move the 3 file in the last folder created.

i don't konw how to make it .

 

The file found in a path and the folder in another path 

Thank you 

0 Kudos
Message 8 of 29
(1,031 Views)

@A.M.k1984 wrote:

1 . I want to creat a folder name with SN12345 .

2. I want to move 3 files (.amcd,,aban,.txt) to the folder already created Sn12345. 


So is the only user input is the folder name? E.g. a string control where he enters "SN12345"?

What are the full names of these three files? Do they match the folder name, e.g.:

 

  • Sn12345.amcd
  • Sn12345.aban
  • Sn12345.txt

Something else?

What should happen if some of these files don't exist? (error? Ignore?)

0 Kudos
Message 9 of 29
(1,023 Views)
Solution
Accepted by A.M.k1984

Here's a simple example that created a folder based on SN and moves three file matching the SN to the folder: The files are expected to be in the same folder as the VI, but you can easily expand that.

 

altenbach_0-1698938035871.png

 

You don't need to test if the folder already exists, just ignore the error if it does (assuming that there won't be a existing file with that name). We also ignore errors if the move does not succeed. You need to expand the code to correctly deal and report all possible error scenarios.

Note that I am using a numeric control for the serial number. This ensure that only valid characters will end up in the folder/file names.

Message 10 of 29
(1,017 Views)