find command seems to lock files

Chris Wagner wagnerc@plebeian.com
Mon Aug 26 01:57:00 GMT 2019


On 2019-08-19 8:33 am, Morten Kjærulff wrote:
> find //$server/d$/dir/subdir*/subsubdir -name 'thefile' -printf '%A+\n'
> 
> Problem is that it seems this command locks thefile, as the application
> sometimes can't delete it.

Unfortunately, yes.  On Windows, a "full stat" requires that the file be 
opened.

This is why Perl has the ${^WIN32_SLOPPY_STAT} flag variable.

https://metacpan.org/pod/distribution/perl/pod/perlvar.pod#${^WIN32_SLOPPY_STAT}
> ${^WIN32_SLOPPY_STAT}
> 
> If this variable is set to a true value, then stat() on Windows will 
> not try to open the file. This means that the link count cannot be 
> determined and file attributes may be out of date if additional 
> hardlinks to the file exist. On the other hand, not opening the file is 
> considerably faster, especially for files on network drives.
> 


-Chris

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



More information about the Cygwin mailing list