LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to append file path

I want to move a file and define the path based on what it is saved as. The file name always has six numbers then a space. I want to determine the drive it goes into based on the second number(either 0 for R:\ or 1 for Y:\), and then the first folder in the drive is the first three numbers of the file name followed by three x's, then the folder within that is the exact six numers. then i want to make a new folder videos (if one doesnt exsist yet) and place the original folder into there.

 

For example the file 904425 is in the C:\ drive so because it is a 0 as opposed to a 1 for the second digit it goes into the Y:\ drive, then into the folder 904xxx then into the folder 904425, then into the Videos folder. 

 

Would it be best to create three variables by truncating the folder name and if so how would i get the folder name into something that i can then append to the file path. 

 

Thanks 

Billy 

0 Kudos
Message 1 of 18
(10,522 Views)

Look at the Build Path function in LabVIEW.  It will allow you to take a file path and append to it.  The part you append can be a string that is determined by other functions.

0 Kudos
Message 2 of 18
(10,498 Views)

I would add to the Ravens fan's comments that you will likely find the 'path to string' and 'string to path' functions highly useful.  This will allow you to do more detailed parsing of the string (that used to be your path).  You'll also find 'match pattern' highly useful for the parsing of the string.

 

CLA, CTA
Not my tempo... AGAIN!
0 Kudos
Message 3 of 18
(10,490 Views)

@GarryGarrett wrote:

I would add to the Ravens fan's comments that you will likely find the 'path to string' and 'string to path' functions highly useful.  This will allow you to do more detailed parsing of the string (that used to be your path).  You'll also find 'match pattern' highly useful for the parsing of the string.

 


Not that most people care, but manipulating paths as strings can break things if you move to another platform that doesn't adhear to the same folder conventions.  By that I mean some operating systems won't have a "C:\blah\what.vi" where drives start with a letter, then colon, and folders are seperated by "\".  The Build and Strip path function is made to be platform independent and will work on an OS that LabVIEW supports.

0 Kudos
Message 4 of 18
(10,477 Views)

this worked however i am using copy and then will delete after confirming that it is transfered and the contents are all there, However it is putting an exta folder step in my path. I have attached my vi please help me 

0 Kudos
Message 5 of 18
(10,465 Views)

Can you run your VI with the controls filled in.  Put array indicators on your wires going from inside the loop to outside with auto-indexing turned on.  That way we can see what the paths that you are using and getting.  Once run, Save all values as default on the controls.

 

Note, you do not need to use the array size wired into N of the For Loop when you have autoindexing turned on.

 

List Files and Folders lists all files and all folders in your initial path.  Are you sure this is what you want?

 

We need to see some examples of your files and file paths so we can know where your extra folder step is coming from.

Message 6 of 18
(10,458 Views)

In your code, you've wired fixed path (Input Path) to the Move function node. So even in loop It will try to move the entire folder to some a path specified in as Traget path. Also the target path is some file path...!!

 

What are you trying to do in this code??

 

Well other observations is:

You need not connect anything to the N terminal of FOR LOOP.


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


Message 7 of 18
(10,449 Views)

A screen shot is shown with my code as well as the front panel and the start location and end location. On the top left I want that folder shown to be in Y:\904xxx\904407\Video, however there is another folder after that which is the location. I cannot specify more in the front panel because the folder being moved is always going to be named differently and for simplicity I dont want to have to change that every time to go one folder further

 

0 Kudos
Message 8 of 18
(10,449 Views)

I want to move what is inside video backup folder to its proper location. there are several folders inside the video backup folder each going to a different place but under the same format 

0 Kudos
Message 9 of 18
(10,443 Views)

What is inside of your C:\Users\Department93\Documents\Video Backup Folder\904407 folder?  I'm willing to bet there is just a Video Backup Folder in there.


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
0 Kudos
Message 10 of 18
(10,433 Views)