Emacs Dired rename many files

前端 未结 2 1571
忘了有多久
忘了有多久 2021-02-01 03:53

How to rename from:

VAR1_1F_text.txt
VAR2_1F_text.txt
VAR3_2F_text.txt

to

1F_VAR1_text.txt
1F_VAR2_text.txt
2F_VAR3_text.txt
         


        
2条回答
  •  北海茫月
    2021-02-01 04:33

    This can easily be done using dired:

    1. Enter a dired view of your directory

    2. Switch to writable dired mode (wdired-change-to-wdired-mode): C-xC-q

    3. Edit the file names listing as if it were a normal buffer (for example using a keyboard macro or a rectangular selection or query-replace). Here is a regexp-based solution:

      C-M-%\(VAR.\)_\(..\)RET\2_\1RET

    4. Finish editing (wdired-finish-edit): C-xC-s or C-cC-c

    You're done!

提交回复
热议问题