LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

To check TDMS locking in other software

Solved!
Go to solution

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 🙂

0 Kudos
Message 1 of 14
(248 Views)

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…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 14
(241 Views)

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..

 

0 Kudos
Message 3 of 14
(233 Views)

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.

0 Kudos
Message 4 of 14
(221 Views)
Solution
Accepted by topic author Nikitha02

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…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 14
(218 Views)

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. 

0 Kudos
Message 6 of 14
(187 Views)

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:

  • When you want to defragment a TDMS file and get an error then you know the file is locked. You don't like this behaviour because "you aren't sure about the error message"…
  • You want to move the TDMS file anyway, but you don't like to move first. What's wrong with "move first (and check for locked files)" followed by "defragment TDMS"?
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 14
(179 Views)

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.

Rolf Kalbermatter
My Blog
0 Kudos
Message 8 of 14
(172 Views)

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.

 

 

0 Kudos
Message 9 of 14
(165 Views)

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. 

0 Kudos
Message 10 of 14
(163 Views)