LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

renaming directory in Labview 5.1

Can someone tell me how to programatically rename a directory/folder that already exists on the drive through Labview 5.1

Thanks,
Shoaib
0 Kudos
Message 1 of 5
(2,787 Views)
You can't rename a directory or file programatically. You have to make a copy with the new name and then delete the original. Obviously, if you are talking about a directory you have to make the function recursive so that it will transfer the entire directory structure inside the original directory.

If you like, I can send you a VI that I wrote to do this.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 5
(2,787 Views)
Just had another thought. You should also be able to write a VI that uses the System Executive function to tell the Operating System to rename the directory. Haven't thought about this much because it's not something I have had to do much.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 5
(2,787 Views)
Use "Move" in the advanced file functions menu. Input the new name (full path) as the target path.


LabVIEW, C'est LabVIEW

0 Kudos
Message 4 of 5
(2,787 Views)
Ok I have found two solutions

1. Use system Execute and use mv . ren or rename doesnt work with system exec.vi
Using mv is much faster than Labview's Move function and it doesnt crash if the directory has read only files.

2. I called a rename function found in msvcrt.dll I am attaching the example with it.
0 Kudos
Message 5 of 5
(2,787 Views)