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: find command seems to lock files


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


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