07-08-2013 09:22 AM
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
07-08-2013 09:46 AM
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.
07-08-2013 09:49 AM
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.
07-08-2013 10:06 AM
@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.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
07-08-2013 12:18 PM
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
07-08-2013 12:26 PM
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.
07-08-2013 12:38 PM
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.
07-08-2013 12:42 PM
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
07-08-2013 12:46 PM
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
07-08-2013 12:57 PM
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.