Bulk Create Paths With Brace Expansion

Generate many names at once with {a,b} lists and {1..5} ranges.

macOSbashautomationshellscriptingLow risk
Run mkdir -p project/{src,tests,docs} to create three directories in one command.

01Command

Command
$ mkdir -p project/{src,tests,docs} && touch project/src/file{1..5}.txt

02What it does

Brace expansion expands patterns before the command runs, so a single line can create dozens of files or directories. It makes repository scaffolding and fixture setup fast and consistent, and it is unavailable through file-manager dialogs.

03Risk

RiskLow risk
RequirementsmacOS default zsh/bash (bash 3.2+; some features need bash 4+ via Homebrew)
CompatibilitymacOS with bash 3.2+ (GNU bash 4+ via Homebrew for advanced features)
!Warning: Expansion happens before globbing; if a match is wrong, the command receives the literal brace pattern.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

Last verified: 2026-10-13 · Category: Developer