From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

detect an open file on a share before the folder is moved

I'm adding an archive feature to a labview application.

 

It will archive all the files and subdirectories within the directory I point to.

 

My challenge is as follows: The directory is on a network share drive so before the VI moves the directory to the archive location it needs to know if any files are open.  If any are open then it would try again later.  If the labview move function errored out before it moved a directory with open files it would be the perfect solution but it doesn't function this way - it errors after it moves everything except the open files.  Moving all closed files then moving the others when they become available isn't an option for me.

 

In researching this it appears I need to access some kind of network management interface to get this info. 

 

Does anyone know what resource I could use for this?  I thought "active directory services", accessed through .net, but it seems "user centric (namespace)" not file status centric - not sure though - haven't worked with ADS much and find it less than user friendly to research.

 

I figure there has to be some mechanism I can hook into programmatically as a network client to check if any files within a directory are open.

 

My application will run on a network client and I don't have access to the server/s hosting the share.

 

I'm sure others have encountered this situation or maybe you could point me to another forum for this?

 

Cheers,

Christopher

0 Kudos
Message 1 of 2
(2,068 Views)

Hi Cristopher,

 

It seems like the best way to achieve this functionality would be to use two steps. First, check if any of the files in the directory are open, then create the archive only if none of the files are found to be open.

 

You may want to check out the following page: How Can I Check if a File is Already Open? The issue of checking for applications being run on different machines within a network is addressed there, so it may be a good resource for you. There are also several other Knowledge Base and Developer Zone articles linked to that page that should be helpful.

 

I hope that helps!

 

 

Matt
NI Community Team
National Instruments
0 Kudos
Message 2 of 2
(2,047 Views)