+ Reply to Thread
Results 1 to 9 of 9

Thread: Check if file over network is in use?

  1. #1

    Default Check if file over network is in use?

    Hi there,

    In our software, you run the program locally and pull data from another area on the network. We want to make sure that no users are working in our software when they run one of our updates. We have a file labeled fpuser.dat that would be in use if at least one person is signed in to our program. The only problem is that the fpuser.dat file is located on the network and not locally. Is there a way to check and see if the file is in use on a network?

    If this is not possible, do you know of a way to accomplish something like this. We are worried that a user being logged in during an update that includes dictionary changes could be harmful to their data files. Any help would be wonderful. Thanks, as always!

    Brandon

  2. #2
    Join Date
    Mar 2004
    Posts
    4,307

    Default Re: Check if file over network is in use?

    Brandon,

    Does the "Check In-use File..." function not work in your case?

    I checked the following:

    Set Variable %INUSE% to FUNCTION:Check In-use File "\\Win7-64\Corpdata\test.dat"

    The 'test.dat' file was located on another machine and was locked (in-use) and the function returned '1'.

    Friedrich

  3. #3

    Default Re: Check if file over network is in use?

    Hey,

    I return a -1 when using that function. I am also telling it to check %DATAPTH%\fpuser.dat. Is that my problem. I do not know what the end users network path will be but I do know that this variable will always have the path to the shared data folder on their network.

    Brandon

  4. #4
    Join Date
    Mar 2004
    Posts
    4,307

    Default Re: Check if file over network is in use?

    Brandon,

    '-1' means "File not found" here. That means, you point to an incorrect file location.

    Friedrich

  5. #5
    Join Date
    Mar 2004
    Posts
    4,307

    Default Re: Check if file over network is in use?

    BTW, and if this is a mapped drive on an UAC-aware operating system, make sure that the mapped drive is 'accessible' by your process.

    http://www.lindersoft.com/forums/showthread.php?t=31410

    Friedrich

  6. #6

    Default Re: Check if file over network is in use?

    ? That is weird.

    I also just tried the same function but this time I told I used the actual network path \\server2900\fpa\fpuser.dat. This also returned -1, but I can physically see the file in that location? Any ideas, I'm still playing with it too.

  7. #7

    Default Re: Check if file over network is in use?

    Just saw your last post, I am going to play around on that. I am using a Windows 7 machine to connect to a windows 2003 server.

  8. #8
    Join Date
    Mar 2004
    Posts
    4,307

    Default Re: Check if file over network is in use?

    It's very simple. The CreateFile Windows API to open the file returns INVALID_HANDLE_VALUE. That means the \\server2900\fpa\fpuser.dat file is not available (file not found) or the network share is not accessible (in fact, that also means 'file not found').

    Just for fun, try the "If File/Folder..." script function to check if the file exists and I am sure you'll get the same result.

    Perhaps a permission problem!?

    Friedrich

  9. #9
    Join Date
    Mar 2004
    Posts
    4,307

    Default Re: Check if file over network is in use?

    Assuming that the file/folder information is correct, it's a permission problem (IMO)

    Friedrich

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •