1

say I have this folder structure with these files inside:

./
 |---- orig/
           |--- 1a
           |--- 1b
           |--- 2a
           |--- 2b
 |---- 1/ <empty>
 |---- 2/ <empty>

I'd like to get this with a single mv command:

./
 |---- orig/ <empty>
 |---- 1/
        |--- 1a
        |--- 1b
 |---- 2/
        |--- 2a
        |--- 2b

I was thinking in something like this, but I cannot find anywhere if there are some kind of "variable wildcards" for shells:

$ mv orig/<var>* <var>/

Is this possible in zsh, bash or similar?

Pizzicato
  • 111
  • 2

1 Answers1

0

I did it in bash with the following loop:

for i in {1..2}; do mv orig/$i* $i; done
  • 1
    Yep, i knew how to do it with loops, but the question is more about the variable wildcards usage, or better, existence – Pizzicato Jan 20 '17 at 11:59