LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

rename files programatically

Hi,
 
can anybody tell me how to rename files without changing content or directory.
It seems to be sooo easy (and most likely it is) but I couldn´t find any LV function for this.
 
Thank you
0 Kudos
Message 1 of 12
(16,244 Views)
On the advanced file palette you'll find the move function. You can use this to rename files.
Message 2 of 12
(16,241 Views)

Hi,

I know about this function, but I don´t want to move this file!

I just want to rename it.

With the help of the FTP functions it is possible to rename a file but I don´t want to start a ftp session for such a simple thing.

Best wishes  

0 Kudos
Message 3 of 12
(16,216 Views)
Move doesn't necessarily move a file to another directory. You can use it like this:
Source path: D:\Test\file_before.ext
Target path: D:\Test\file_after.ext

Use the same path but a different filename. This is the same as rename.



Message Edited by dan_u on 11-20-2007 02:14 PM
Message 4 of 12
(16,213 Views)

Thank you a lot!

This is what I wanted.

0 Kudos
Message 5 of 12
(16,194 Views)
Renaming directories with Move seems very inefficient:
Folders containing large files take a number seconds to rename, (using LV 7.1.1)

Is there a better way to simply rename a directory, instead of what seems to be a Copy-Delete?

0 Kudos
Message 6 of 12
(16,056 Views)
You can just move the directory instead of every file in the directory.

In general move only does a copy-delete when you move the files to another partition.

Matt W


Message Edited by Matt W on 01-22-2008 05:51 PM
Message 7 of 12
(16,047 Views)
> You can just move the directory instead of every file in the directory.

That's the idea, yes...

> In general move only does a copy-delete when you move the files to another partition.


This is not what I'm seeing.

I create a VI with Move (from
Advanced File Functions within File I/O) as the only operation.
I supply Move with, say:
source path: E:\OldDirName
   a directory with two 600MB (.rar) files inside
target path: E:\NewDirName
  which does not yet exist

I run the VI.  It runs for at least 2 minutes.
I can
watch (in the Explorer window) the NewDirName folder appear, and files one-by-one, inside it, while the old one still exists. OldDirName finally disappears just before the VI stops execution.

If I do the same with an empty folder, it is nearly instantaneous.
0 Kudos
Message 8 of 12
(16,016 Views)

If you don't mind losing platform indepedence, you can simply call the OS command using the System Exec VI. In Windows, this would be "rename" or "ren". you might need to prepend it with "cmd /c" to get it to work.


___________________
Try to take over the world!
Message 9 of 12
(16,003 Views)
I ended up making a call to the Windows API MoveFile function ( http://msdn2.microsoft.com/en-us/library/aa365239.aspx ), which works as I'd hoped it would.
Message 10 of 12
(16,001 Views)