How can I find a file in folder that start with a character (for example 'A') and the longer of file name does not exceed 8 ?

I know to find a file I use find fileName, but how about the longer of file name ?


closed as unclear what you're asking by Timothy Martin, Stephen Kitt, Archemar, Anthony Geoghegan, GAD3R Mar 7 '17 at 11:50

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    What do you mean by "the longer of file name"? Do you mean the remainder, as in everything after the A? – Celada Mar 6 '17 at 20:08
  • I have found that find's options are so esoteric beyond just things like "type" that it is so much easier to just pipe it to grep. – Aaron D. Marasco Mar 6 '17 at 22:18

Wildcard is what you need:

find . -path './A???????' -type d


'.' will search in the current directory.

-path './A???????' this is a pattern: a word starting by 'A' and it has 8 characters total.

'-type d.' will only show directories (not files).

Not the answer you're looking for? Browse other questions tagged or ask your own question.