Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Borislav Borissov
  Where is Borislav Borissov?
 Sofia
 Bulgaria
 Borislav Borissov
 To: Gerrit Broekhuis
  Where is Gerrit Broekhuis?
 Holten
 Netherlands
 Gerrit Broekhuis
 Tags
Subject: RE: how to detect if a file is in use
Thread ID: 104411 Message ID: 104414 # Views: 1 # Ratings: 1
Version: Visual FoxPro 8 Category: General VFP Topics
Date: Wednesday, August 16, 2006 11:40:19 AM         
   


> Hi,
>
> I'm archiving files from my local disk (c:) to a .ZIP file, using the x-zip component in my VFP application. The files to be zipped can be virtually anything, like .PDF, .DOC, .XLS, etc., etc..
>
> How can I make my application detect that a file is opened on my PC before trying to add the file to the .ZIP file? Adding an opened file creates garbage when zipping.
>
> Regards, Gerrit



Try to FOPEN() it:

Something like that:
? IsFileOpened([c:\test\MyFile.PDF]) && .t. -> File is opened and you could not put it in BackUp
                                     && .f. -> File is NOT opened and you could put it in BackUp


FUNCTION IsFileOpened(lcFullFileName)

  LOCAL lnFileH, lbRetVal
  lnFileH  = FOPEN(lcFullFileName, 12)
  lbRetVal = (lnFileH < 0)
  IF NOT m.lbRetVal
     FCLOSE(m.lnFileH)
  ENDIF

RETURN lbRetVal

Borislav Borissov



ENTIRE THREAD

how to detect if a file is in use Posted by gerrit broekhuis @ 8/16/2006 11:24:33 AM
RE: how to detect if a file is in use Posted by Borislav Borissov @ 8/16/2006 11:40:19 AM
RE: how to detect if a file is in use Posted by gerrit broekhuis @ 8/16/2006 3:53:24 PM
RE: how to detect if a file is in use Posted by Ronan Masangcay @ 8/23/2006 10:25:36 AM