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: 

Replace File Name of Path

Solved!
Go to solution

EDIT:

 

I am trying to build a string array into a path, however it ends up not being formatted correctly.  Perhaps this is a "scan code" issue with the backslashes?

 

snip.png

 

Is there a better/correct way to do this?  I want to just change the file name of an already existing path.

 

For example:

 

c:\Desktop\Folder\File1.csv

 

becomes

 

c:\Desktop\Folder\FileName.csv

 

My "Spreadsheet String" is just a Path to String of an existing file path in the same destination folder. 

 

I break the old path (in string form) into an array seperated by the slash.  Then I replace the last array element (the file name).  Then I make it an array again and convert it to a path.  Although it looks correct, LabVIEW throws an error with this path saying it does not exist.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If someone helped you out, please select their post as the solution and/or give them Kudos!
0 Kudos
Message 1 of 6
(3,106 Views)
Solution
Accepted by topic author MrHappyAsthma

Is this what you're looking to do ?

appended path = c;\desktop\folder\filename.csv

 path.jpg

 

Message 2 of 6
(3,074 Views)

That looks about right.  However I am unfamiliar with that first function.  Could you please link me to the help document for it and maybe explain what it does?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If someone helped you out, please select their post as the solution and/or give them Kudos!
0 Kudos
Message 3 of 6
(3,071 Views)

 

Both functions are in the File I/O palette. Strip Path & Build Path.

 

You can turn your context help on with Ctrl + H to see the details Smiley Wink

 

 

Message 4 of 6
(3,067 Views)

Ah, yes!  Thank you!  The Strip File Path function did exactly what I needed in a very robust way.  I cannot believe I had never come across that function before.  It would have saved me much struggling 😛

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If someone helped you out, please select their post as the solution and/or give them Kudos!
0 Kudos
Message 5 of 6
(3,062 Views)

Yes there are some little gems hidden in them there palettes !

 

Thanks for the kudos ... Smiley Happy

 

0 Kudos
Message 6 of 6
(3,053 Views)