I can create multiple numbered folders at once like so:mkdir Season\ {1,2,3,4,5}Is there a way I can run the following commands in a oneliner (without a for loop):mv 01.* Season\ 1mv 02.* Season\ 2mv 03.* Season\ 3mv 04.* Season\ 4mv 05.* Season\ 5Bonus points if there's a ZSH way to do it.
Bash - move files into numbered folders oneliner
bash;zsh
With zsh:autoload zmv # best in ~/.zshrczmv -n '(<1-5>).*' 'Season $(($1))'(remove the -n when happy)Note that it calls one mv per file so it would be less efficient than the 5 mv commands of your question (unless you do a zmodload zsh/files beforehand to get a builtin mv).A perl's rename alternative:rename -n '$_=Season $1/$_ if /0*(\d+)/' 0[1-5].*(remove -n when happy)Note that rename calls the rename() system call, so that only works to move files within the same file system (while mv will resort to copy+unlink when moving files across file system boundaries).With mmv (moving across FS boundary is supported, but then note that not all attributes will be preserved and for symlinks a copy of the target file is created):mmv -n '0[0-9].*' 'Season #1/'(remove -n when happy)