Skip to main content
added 69 characters in body
Source Link
Stéphane Chazelas
  • 584.6k
  • 96
  • 1.1k
  • 1.7k

With zsh:

setopt extendedglob # best in ~/.zshrc
mv A/^(file|directory)(|2)(D) B/

(the (D) to include dot (hidden) files).

With bash:

shopt -s extglob dotglob failglob
mv A/!(@(file|directory)?(2)) B/

With ksh93

(FIGNORE='@(.|..|@(file|directory)?(2))'; mv A/* B)

With zsh:

setopt extendedglob # best in ~/.zshrc
mv A/^(file|directory)(|2)(D) B/

(the (D) to include dot (hidden) files).

With bash:

shopt -s extglob dotglob failglob
mv A/!(@(file|directory)?(2)) B/

With zsh:

setopt extendedglob # best in ~/.zshrc
mv A/^(file|directory)(|2)(D) B/

(the (D) to include dot (hidden) files).

With bash:

shopt -s extglob dotglob failglob
mv A/!(@(file|directory)?(2)) B/

With ksh93

(FIGNORE='@(.|..|@(file|directory)?(2))'; mv A/* B)
added 9 characters in body
Source Link
Stéphane Chazelas
  • 584.6k
  • 96
  • 1.1k
  • 1.7k

With zsh:

setopt extendedglob # best in ~/.zshrc
mv A/^(file|directory)(|2)(D) B/

(the (D) to include dot (hidden) files).

With bash:

shopt -s extglob dotglob failglob
mv A/!(@(file|directory)?(2)) B/

With zsh:

setopt extendedglob
mv A/^(file|directory)(|2)(D) B/

With bash:

shopt -s extglob dotglob
mv A/!(@(file|directory)?(2)) B/

With zsh:

setopt extendedglob # best in ~/.zshrc
mv A/^(file|directory)(|2)(D) B/

(the (D) to include dot (hidden) files).

With bash:

shopt -s extglob dotglob failglob
mv A/!(@(file|directory)?(2)) B/
Source Link
Stéphane Chazelas
  • 584.6k
  • 96
  • 1.1k
  • 1.7k

With zsh:

setopt extendedglob
mv A/^(file|directory)(|2)(D) B/

With bash:

shopt -s extglob dotglob
mv A/!(@(file|directory)?(2)) B/