Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rearrange file names in Emacs [closed]

I have a batch of files with the same format say bmp, the file name is 0.bmp 1.bmp ... 99.bmp, I want to change the file names, say 0.bmp to 99.bmp, 1.bmp to 98.bmp etc. can emacs do this in dired-mode? I use emacs under Windows.

like image 951
toolchainX Avatar asked Dec 26 '22 13:12

toolchainX


1 Answers

You can use M-x wdired-change-to-wdired-mode to make a dired buffer editable. Afterwards a simple keyboard macro with a counter, starting from the end of the dired buffer, should do the trick for you.

If you don't want to use a macro an alternative would be:

M-x replace-regexp
Replace regexp: ^[0-9]+
Replace regexp with \,(- 99 \#&)
like image 91
Bozhidar Batsov Avatar answered Jan 04 '23 16:01

Bozhidar Batsov