0

I have the following files:

/home/wiki/15000_20000/xx00
/home/wiki/15000_20000/xx01
/home/wiki/15000_20000/xx02
...
/home/wiki/15000_20000/xx4686

How do I rename xx00, xx01, ..., xx4686 to 152000, 152001, ..., 15204686, that is, replace xx with 1520?

3 Answers3

1

Using mmv you can do:

mmv /home/wiki/15000_20000 'xx*' '1520#1'

mmv is not installed by default, but you can install it by running:

sudo apt install mmv
0

You can rename a file with the mv command which is used to move and rename files (see here). In your case this would be for one file:

mv /home/wiki/15000_20000/xx00 /home/wiki/15000_20000/152000

According to the number of files you have to rename you should consider automating this process (see here). This should do the trick:

for FILENAME in *; do mv $FILENAME Unix_${FILENAME#??}; done

You have to execute that command in the folder where the files you want to rename are located in.

0

You can rename files with mv. So, use: mv [file you want to rename] [new name]
See:

  1. mv --help
  2. man mv