-1

I want to create a folder like "example.txt, example.Txt, example.TxT... all possible combinations.

closed as unclear what you're asking by Jeff Schaller, roaima, Toby Speight, dr01, Rui F Ribeiro Nov 1 '18 at 7:31

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.

  • a "filename" like "example.txt" implies a file not a "folder" / directory; are you sure you want directories named like that? Also, should the upper & lower-casing happen with the "example" letters? – Jeff Schaller Oct 31 '18 at 11:17
  • It depends on the underlying filesystem. Some may be case insensitive... – Patrick Mevzek Oct 31 '18 at 15:11
4

With shells with csh-style brace-expansion support:

mkdir example.{t,T}{x,X}{t,T}

With zsh, you can shorten it to:

mkdir example.{tT}{xX}{tT}

if you enable the braceccl option (which I wouldn't otherwise recommend enabling globally as it kinds of conflicts with some other usages of braces) with set -o braceccl.

If you want all possible combinations of letters and numbers, assuming you want to limit to ascii letters and numbers (and not the thousands of other letters and numbers of different scripts in Unicode), with bash, zsh, or ksh93:

mkdir example.{{a..z},{A..Z},{0..9}}{{a..z},{A..Z},{0..9}}{{a..z},{A..Z},{0..9}}

Which with zsh -o braceccl you can shorten to:

mkdir example.{a-zA-Z0-9}{a-zA-Z0-9}{a-zA-Z0-9}

But as that's 238328 ((26+26+10)3) directories, you may reach the execve() limit on the size of arguments and environment. You could work around that by using the builtin mkdir in zsh (by doing zmodload zsh/files) or doing:

 printf '%s\n' example.{{a..z},{A..Z},{0..9}}{{a..z},{A..Z},{0..9}}{{a..z},{A..Z},{0..9}} |
   xargs -0 mkdir
  • can you help me ? home/example_one/example_two/example_three/.......example_billion i want to show last locations and get info – Irakli Oct 31 '18 at 18:53
  • @Irakli, if you have a separate question, please ask it as a new question here, if possible with more details as I'm not sure I understand what you mean from your short description. – Stéphane Chazelas Oct 31 '18 at 21:20

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