11-19-2014 01:50 PM
I have an application that collects and records real-time data from a DAQ card. All the data collection and recording works perfectly and results in a binary data file on the local hard drive. In the past we've had to manually move these files to a networked drive so that there's enough space for additional recordings (the files are quite large) - but that's what programs are for! So, I added the "Move" function to move the folder containing the files to the network drive. However, what happens is that it copies the folders correctly, but none of the actual files. The files stay in their original position on the local drive. "Copy" works fine, recursively copying all the directories and files, but I need to remove them from the drive. Instead of doing some kind of Copy and Delete kludge, I'd just like to get Move working the way it's supposed to.
I've tried doing the move to a different spot on the local drive which also doesn't work, so it's not a problem with the network. I made sure I closed the file reference (with a flat sequence) before trying to Move, in case having an open reference meant that it couldn't delete. Not sure how to proceed debugging - any ideas?
Thanks!
11-19-2014 01:54 PM
Do you still have references to the files open? Are you getting an error?
According to the help, the contents of the folder (recursively) should be moved.
11-19-2014 05:22 PM
I tried it using LabVIEW 2012. Not sure I did the test correctly, but it started working, then gave me Error 5. It looked like it moved some files, but left the folders behind.
So I decided to look at the equivalent function in OpenG. It has a Force File Move that says it will do the move even if the target already exists.
But there's a serious "gotcha" that got me -- while Move has the Source wired in the top left, and Target in the second slot, the OpenG version reverses this convention, with the Target on top! [Don't ask me why ...]
But the good news is that this seems to work just fine (and quickly). It created the files and folders, and cleaned up after itself, not even leaving the parent folder behind on the source.
If you don't have OpenG, find a copy of VIPM (it now comes included with LabVIEW), install it, and open the packages. I recommend installing the OpenG Toolkit -- this will bring in (most of) the OpenG routines, including the File Library, where Force File Move lives.
Bob Schor
11-20-2014 01:10 AM
Do you get any error messages? I didn't try to generate files and then move them with the same program, but I tested the Move function in LabVIEW 2013 several times with relatively big set of files, approx 300 MB, 5906 files in 683 folders, mix of VIs, binaries, PDF, text files, etc... 2-3 times I added also some large files > 1 GB. It works without any problems in most cases, probably more than 30 times. The test was using existing files structure and files.
I got errors only when the folder was open in Windows Explorer. The error was: Error 6 occurred at Move in test.vi, but this is actually expected. All files were moved; the program was not able to delete the source path. Well sometimes it worked even in this case without errors.
BTW: I tested also with some hidden files. The Move function removes the hidden attribute.