08-20-2024 06:00 AM
I am facing trouble in finding if the TDMS is open in any other application (Preferably DIAdem) using LabVIEW.
Situation : when I try to move the bulk amount of .tdms files from one location to other by defragmenting, if any of the tdms file is open on DIADEM, defragmentation of this open file will create an ERROR 6 (Note: only the Open file on the DIADEM will not pass defragmentation because of error), I tried to use the .NET construct for files to check if the file is open, or any property that will help me inform if the tdms file is open on DIADEM and provide the error bit. None of them helped.
The error is not generated when the tdms file which is open, is tried to being accessed for read, write, allocate memory or any other operations, Error will only get generated if the defragmentation operation is applied on the TDMS file opened on DIADEM.
Any tips or solution will help big!!
Thanks in Advance 🙂
Solved! Go to Solution.
08-20-2024 06:10 AM
Hi Nikitha,
@Nikitha02 wrote:
The error is not generated when the tdms file which is open, is tried to being accessed for read, write, allocate memory or any other operations,
Error will only get generated if the defragmentation operation is applied on the TDMS file opened on DIADEM.
There you have your answer: defragment the TDMS file!
When you get an error then the file is locked by someone else…
08-20-2024 06:28 AM
Hi Gred,
I will have to check if the file is locked by DIAdem before I do the Defragment, which is important to check and move the file.
But I find no way to check if the file is locked by DIAdem..
08-20-2024 06:51 AM
Also, I get the Generic Error 6 when I do the defragmentation, And Error 6 has many reasons to occur as its name itself specifies. It may be the cause of low storage, unknown error, etc etc, which is not a suitable way to adapt to check the file locking.
08-20-2024 06:57 AM
Hi Nikitha.
@Nikitha02 wrote:
Also, I get the Generic Error 6 when I do the defragmentation, And Error 6 has many reasons to occur as its name itself specifies. It may be the cause of low storage, unknown error, etc etc, which is not a suitable way to adapt to check the file locking.
Can you move the file to a different location before defragmentation?
(Moving should be prohibited for locked files…)
08-20-2024 10:53 PM
Hi,
Yes, that will work, but my idea was to declutter the tdms file first and then move to the target location.
Nevertheless, if this is the only way I must follow moving and then defragmenting.
I was wondering if there is any solution with .Net construct, I didnt find much apart from getting the file details.
If you got more suggestion on this, it helps.
08-21-2024 12:53 AM
Hi Nikitha,
@Nikitha02 wrote:
Yes, that will work, but my idea was to declutter the tdms file first and then move to the target location.
I don't understand your problems:
08-21-2024 04:17 AM
Have you tried to open the file with the LabVIEW file open node and then lock it for exclusive access?
File Open, operation: open only, access: read/write
Deny Access, deny write-only
File Close
File Open should return an error if the file is already opened for exclusive access.
Deny Access will return an error if the file is already opened for write access.
08-21-2024 04:38 AM - edited 08-21-2024 04:45 AM
Hi Gred,
The problem is, moving the tdms files from local folder to network folder, when I first move and then defragment at the network folder, I would consume a lot of time defragmenting the tdms files on the network folder causing the extra processing time of the software.
Time and memory are considered majorly.
when I tell that, I cannot make move to another location locally and then move to network target --> like I said Time consumption is higher than I expect.
08-21-2024 04:43 AM
Hi Rolf,
This was the first attempt I made, thinking that TDMS file opened in DIAdem will behave like any other files that is open. But unfortunately, the TDMS file will never throw error when you try to access it to read/write/edit except for Move and Defragment.
.
But I will have to give a thorough check to get acknowledgement if the tdms file is locked by any other application apart from the move or defragment. checking by move/ defragment will be final option to go, if no solution found.