Problem using 'find' with cygwin

Posted on 2006-05-27
Last Modified: 2013-12-03
Windows XP
Using cygwin

I have seen this question asked in many places but never seen the answer.

C:\>\cygwin\bin\find . -name \*.htm -exec cat "{}" \;
/usr/bin/find: missing argument to `-exec'

is not working properly

I have tried the follwoing
cygwin\bin\find . -name \*.htm -exec cat '{}' \;
cygwin\bin\find . -name \*.htm -exec cat '{}'\;
cygwin\bin\find . -name \*.htm -exec cat '{}' \;

What I have seen for answers are the use xargs

cygwin\bin\find . -name \*.htm -print | xargs  cat

Additionally, since the output of find is a complete path to the file includeing spaces I need to quote the output of the find command prior to passing it into any other utility.


Question by:MichaelAllen
    LVL 86

    Expert Comment

    I'd use that line

    find . -name "*.htm" -exec cat {} \;

    Works fine, for years now...
    LVL 24

    Accepted Solution

    You use it from within cmd.exe. Maybe that is your problem. Start a unix shell and try the line and that should do the trick or run it with something like
    sh -c 'find .... ' ..


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Suggested Solutions

    What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
    For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now