Menu

find.exe

Help
2007-09-26
2012-07-26
  • grumbled00k

    grumbled00k - 2007-09-26

    I've been using find for many years in the linux bash. Now I'm confused when using gnuwin32's find.exe,
    e.g. this way:

    >find "path" -iname "n"
    or
    >find "path" -iname "
    nnn"
    or
    >find "path" -iname "
    nbb"

    work fine, but I get:

    find: paths must precede expression
    Usage: find [-H] [-L] [-P] [path...] [expression]

    when executing this:

    >find "path" -iname "n"
    or
    >find "path" -iname "nb"
    or
    >find "path" -iname "
    .nb"
    or
    >find "path" -iname "*b"

    What's the difference to linux find here? (a bug???)

     
    • wwp

      wwp - 2007-09-26

      What's the exact value of "path" in your examples?

       
    • grumbled00k

      grumbled00k - 2007-09-28

      Any path, like "." or "C:\users\user\documents".

      Try searching for "nnn", "nn" or "n" in the default path (".").
      Only "n" gives the error.

       
    • grumbled00k

      grumbled00k - 2007-12-14

      Still no idea? ... gnuwin's find is completely useless when it's impossible to search for files with a certain extension ...

       
      • GnuWin

        GnuWin - 2007-12-15

        The examples you gave, all work fine on my system (MS-Windows XP SP2). For example,

         find . -iname "*n*"
        

        lists all the files in the current directory and below with an n in their name.
        So you'll have to give a more specific example before this can be investigated further.

         
        • Jon Moore

          Jon Moore - 2008-03-14

          I think I've seen the same thing. It looks like the gnuwin32 find 4.2.20 (my version) is expanding the wildcard using matches in the current directory. That gives the kind of errors grumbled00k saw if there is more than one match. So with a file structure like this

          ./foofoo
          ./Child/foofoo
          ./Child/foobar

          Running find . -iname 'foo*' from . returns only the first two files
          Running from ./Child gives the "Paths must precede expression" error
          Running from .. returns all three files

          This looks like a bug. It is a difference in behavior compared to GNU find 4.1.7 on linux and the cygwin version of GNU find 4.2.11 (which always return all three files)

           
  • Ingo Karkat

    Ingo Karkat - 2009-12-14

    Same problem here, gnuwin32 find version 4.2.20. The problem (expanding the
    wildcard using matches in the current dir, resulting in "Paths must precede
    expression" error) manifests itself on Windows Vista Enterprise SP1 (x86) and
    Windows 7 Ultimate (x64), but not on Windows XP Prof. SP2.

    That's why user gnuwin32 couldn't reproduce this on XP; you need Vista or
    Windows 7.

     
MongoDB Logo MongoDB