1

My folders look like this:

$ ls
total 20K
drwxr-xr-x 2 ychaouche ychaouche 4.0K Mar  4  2020 cdc-firewall-v1
drwxr-xr-x 2 ychaouche ychaouche 4.0K Mar  4  2020 cdc-firewall-v2
drwxr-xr-x 2 ychaouche ychaouche 4.0K Nov 24 10:40 cdc-firewall-v3
drwxr-xr-x 2 ychaouche ychaouche 4.0K Nov 24 10:43 cdc-firewall-v4
drwxr-xr-x 2 ychaouche ychaouche 4.0K Nov 24 11:17 X

I want them to look like this : 1, 2, 3, 4 (get rid of cdc-firewall-v)

Here's what I tried:

$ mmv "*v*" "#2"
*v* -> #2 : no match.
Nothing done.

My reasoning was:

  1. For the from part

    1. * would match cdc-firewall- and be assigned to #1
    2. v would match v
    3. * would match the last number (1, 2, 3, 4) and be assigned to #2
  2. For the to part: replace the whole name with #2 which would be the number.

muru
  • 69,900
  • 13
  • 192
  • 292
ychaouche
  • 945
  • 8
  • 25

1 Answers1

2

mmv refuses to rename folders unless you specify the -r option, which worked in my case with same syntax as above :

 mmv -r "*v*" "#2"
ychaouche
  • 945
  • 8
  • 25