LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

File/Folder Rename

I'm just curious, to my knowledge, there is not direct way of "renaming" a file or folder (other than going through "system exec" or "move"). Is this still the case? 

A while back I needed this function with large binary files, so I'm just wondering if the new LabView versions +2012 allows this.

 

Thanks

 

Kas 

0 Kudos
Message 1 of 12
(11,876 Views)

"Move File" does exactly what you ask for.

Just wire your old filename to "source path" and your new filename to "target path", and the file is renamed.

 

Best regards,

Jens

Kudos are welcome...
Message 2 of 12
(11,868 Views)

you could use copy.vi, where you still have the original file and renamed targeted copy

0 Kudos
Message 3 of 12
(11,864 Views)

Sure, but either way is not straight forward when you have folders and subfolders. Just wondering why they haven't included this function. Maybe I'm missing some underlying difficulties on implementing this.

 

Kas

0 Kudos
Message 4 of 12
(11,858 Views)

@zerotolerance wrote:

Sure, but either way is not straight forward when you have folders and subfolders. Just wondering why they haven't included this function. Maybe I'm missing some underlying difficulties on implementing this.

 

Kas


What is not straightforward about using Move File?  That's what a rename does.  It moves the file to another location.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 12
(11,838 Views)

Sorry, looks like I misinterpreted how windows deals with this issue. I thought that when you rename a large file (e.g. a 12 GB file) in windows, only the name changes (which basically changes the path location only). But using the "move" function in labview I throught generates more disc/processor operation than simply just changing the name.

 

Kas 

0 Kudos
Message 6 of 12
(11,825 Views)

It's really just a naming issue. LabVIEW calls this move, DOS called it rename. in principle it is the same. If the source and target are on the same disk volume, the operation is in fact a simple rename. If the source and target are on different volumes it is a copy with subsequent delete of the original AFTER the copy has ended successfully.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 7 of 12
(11,819 Views)

I'm going to hijack this old thread really quick here just to add in the solution I think OP was hoping for, so that others can find this in the future.

 

I came across this thread because I'm trying to rename a folder that contains 800MB of images. The Move VI takes 10 seconds to do this when the new path is a new folder in the same directory. 10 seconds is just way too long when Windows can normally change a folder name in a split second.

 

I found this document that includes a snippet of the kernel call to do the Move using Windows API. It's runs just as fast as a normal rename action in Windows Explorer and is a perfect solution for large files.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 8 of 12
(11,035 Views)

Hmmm, I'm pretty sure LabVIEW is internally also using the MoveFile() Windows API in the File Move node.It at least used to do that in the past.

 

Maybe they changed something in Explorer in newer versions but it used to call the horrible SHFileOperation API which internally used eventually the Windows APIs too.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 9 of 12
(11,003 Views)
Huh... Yeah that's the vibe I got from the above comments, but that I went and built the code with Move.vi and it took awhile. I then replaced with the API call without changing the paths and it worked great. I'm using LV 2014.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 10 of 12
(10,984 Views)