Rename multiple file in linux


If a directory contains so many files with the extension .txt and if you want to rename it to some other extensions follow the step

# cd /directory/contains/file

shows result before renaming
# rename -n 's/\.txt$/\.bak/' *.txt (file we want to change)

# rename  's/\.txt$/\.html/' *.txt

# rename 's/.txt/.md/i' *

It is useful if the directory contains a lot of files to edit in a single step.

-n, --no-act
 No Action: show what files would have been renamed

* Also we can convert upper case letters to lowercase and  vice versa

# cd /directory/contains/file

# rename 'y/A-Z/a-z/' *

* Renaming file name from:

ctechz.txt0
ctechz.txt1
ctechz.txt2
ctechz.txt3
ctechz.txt4
ctechz.txt5

To file name:

ctechzblog.txt
ctechzblog.txt0
ctechzblog.txt1
ctechzblog.txt2

# rename 's/ctechz/ctechzblog/g' ctechz.txt*




Terima kasih telah membaca artikel tentang Rename multiple file in linux di blog Tutorial Opensource and Linux jika anda ingin menyebar luaskan artikel ini di mohon untuk mencantumkan link sebagai Sumbernya, dan bila artikel ini bermanfaat silakan bookmark halaman ini di web browser anda, dengan cara menekan Ctrl + D pada tombol keyboard anda.

Artikel terbaru :

  • How To Install Cinnamon In Ubuntu 14.04
  • How To Install Mate Desktop In Ubuntu 14.04
  • Creating the first Windows Server 2003 Domain Controller in a domain
  • How To Install Ubuntu 13.10 Server
  • How to Install Nuvola Player in Ubuntu
  • How to establish Emerald in Ubuntu 13.10 & Linux Mint 16
  • How to Restoring iptables Automatically On Boot on Debian and Ubuntu
  • How to Compile FFMPEG with H.264 and LAME in Ubuntu And Debian
  • How to Install Linux on a Playstation 2
  • apt-fast: Improve apt-get Download Speed
  • Artikel terkait :