Mail Archives: cygwin/2012/03/21/17:59:00
leoslists sent the following at Tuesday, March 20, 2012 1:15 AM
>I'm trying to use locate and find. When I issue
> find / -xdev -name "*hallo*"
>
>I get the warning
> find: File system loop detected; `/c/cygwin' is part of the same file
>system loop as `/'.
>
>It is important to note, that I have mounted the C: drive at /c. After
>reading some Cygwin posts I hoped that `-xdev' would solve this, but it
>didn't...
>
>The next thing I tried was pruning the Cygwin dir:
> find / -wholename /c/cygwin -prune -o -name "*hallo*"
>
>But I still get the error message.
>
>Any ideas how I can prevent the loop, but still do the find from root?
>(I want to do the find from root, because inside locate, this determines
>the paths written to the locate database.)
Does this do what you want?
find /c -name "*hallo*" | sed -e 's,/c/cygwin,,' | sort
Although it is not totally cygwin*, my experience is that cmd's dir is
faster than find. (I tried it on my C: (W&) and dir took 70% the time of
find and did not give "access denied" messages.)
"$(cygpath -u "${COMSPEC}")" /c dir /s /b /a: /o:n c:\\ | \
tr -s '\r\n' '\n' | \
cygpath -u -f - | \
sed -e '/^$/d' \
-e '/\/RECYCLER\//d' \
-e '/\/$Recycle.Bin\//d' \
-e 's,/\+,/,g' \
-e 's,^/usr/bin,/bin,i' \
-e 's,^/usr/lib,/lib,i' \
-e 's,^/sbin,/usr/sbin,i' | \
sort -u | \
grep -e 'hallo[^/]*$'
(Whether you use the last 3 sed patterns depends on whether you want things
listed in /bin or /usr/bin. I prefer the former.)
* I debated with myself whether to include this. As I understand the rules,
we're not supposed to have discussions of the use of native programs on this
list, but I thought that it was relevant and connected enough to include.
Should I have sent a separate email to cygwin-talk?
Best wishes,
- Barry
Disclaimer: Statements made herein are not made on behalf of NIAID.
--
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
- Raw text -