This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: quick way to find out if a file is in use by windows?


On Sep 10 11:46, Jurriaan wrote:
> I use the mv command to clean up some directories filled with temporary
> files. These may or may not be in use by windows.
> 
> I used to detect them being in use by windows by mv failing.
> 
> Now, mv is simply taking forever.
> 
> I'm using cygwin 1.7.7(0.230/5/3), windows 2003 server 32 bits with all
> updates on a local NTFS disk.
> 
> I remember reading something about this changing in the last release, but
> I can't find it in the archives anymore (searching for 'file in use'
> didn't work out).
> 
> Is there any way to detect if a file is in use by windows before
> executing 'mv' (I really, really hope I don't have to use the
> 'handle.exe' utility, which takes seconds for each file...)?
> 
> Alternatively, could mv timeout somewhat earlier? I control-C'ed it
> after 15 minutes, which is really too long already.

mv does not timeout.  The underlying unlink function checks if the file
is in use and, if so, moves the file to the bin and sets the delete
disposition so it will be deleted after the last process closes its
handle to the file.  If this fails, unlink silently gives up.  The reason
for the hang must be something else.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]