LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how can I rename a file programmatically?

I want to make a VI that rename a file, how can I do?
0 Kudos
Message 1 of 14
(5,256 Views)
Use the Move VI in the File I/O>>Advanced pallete. Just give it the source file and destination file.

___________________
Try to take over the world!
0 Kudos
Message 2 of 14
(5,254 Views)
Hello,

Two methods are possible :

http://digital.ni.com/public.nsf/websearch/576434CD1B659EE386256F04006909AA?OpenDocument

regards

Marc Larue
NIF
0 Kudos
Message 3 of 14
(5,230 Views)
Hello,

A third method is to use "System Exec" vi and use the ubiquitos Rename Command.

An Example is attached It needs a file temp.txt in C:\

This is true renaming unlike other methods of copying and deleting.

Good Luck

Mache
Good Luck!

Mache
0 Kudos
Message 4 of 14
(5,215 Views)
...and yet a fourth method, if you are a Windows user, is to make use of the runtime libraries provided by Windows. The attached example has been tested with LV 7.1 and Windows XP Pro...

regards

Bruce Smotherman
0 Kudos
Message 5 of 14
(5,057 Views)
Hi does your rename.vi only work on the root c:\ drive?
Can I use the vi when my txt file in located in c:\document and settings\temp\filename.txt?
0 Kudos
Message 6 of 14
(4,954 Views)

For the rename VI to work with a path that has spaces you need to place the path inside quotation marks, like this:

"c:\document and settings\temp\filename.txt"


___________________
Try to take over the world!
0 Kudos
Message 7 of 14
(4,949 Views)
Thanks again. 
Can I use the same procedure (using SystemExec.vi) to delete a file?
0 Kudos
Message 8 of 14
(4,941 Views)

Sure, just use the "del" command instead of "rename".

However, why not use the built-in LV delete file function (in the File I/O>>Advanced palette)?

This will be sure to work across platforms and OSes (for example, if the next windows OS doesn't support DOS commands).


___________________
Try to take over the world!
0 Kudos
Message 9 of 14
(4,937 Views)
Can i change the target path of a file and rename it in the same MOVE.VI?
0 Kudos
Message 10 of 14
(4,755 Views)