rename file

ini adalah cara tercepat untuk rename file jika kamu punya case seperti.

1. rename semua extension .sample menjadi .txt

mari kita coba satu persatu

Rename semua file yang memiliki extension .sample menjadi file asli

#ls
collectors.xml.sample eventdefinitions.xml.sample logalyze-collectors-1.0.xsd logdefinitions.xml.sample repository
definitions local logalyze-definitions-1.0.xsd querydefinitions.xml.sample repository.defs.xml.sample
engine.xml log4j.conf logalyze-engine-config-1.0.xsd reportdefinitions.xml.sample statdefinitions.xml.sample

Mari kita rename

rename 's/\.sample$//' *.sample

outputnya

#ls -ltrh
total 104K
-rw-r----- 1 root root 6.6K Mar 13 20:51 logalyze-engine-config-1.0.xsd
-rw-r----- 1 root root 16K Mar 13 20:51 logalyze-definitions-1.0.xsd
-rw-r----- 1 root root 11K Mar 13 20:51 logalyze-collectors-1.0.xsd
-rw-r----- 1 root root 234 Mar 13 20:51 statdefinitions.xml
-rw-r----- 1 root root 233 Mar 13 20:51 repository.defs.xml
-rw-r----- 1 root root 234 Mar 13 20:51 reportdefinitions.xml
-rw-r----- 1 root root 234 Mar 13 20:51 querydefinitions.xml
-rw-r----- 1 root root 234 Mar 13 20:51 logdefinitions.xml
-rw-r----- 1 root root 845 Mar 13 20:51 log4j.conf
drwxr-x--- 2 root root 4.0K Mar 13 20:51 local
-rw-r----- 1 root root 234 Mar 13 20:51 eventdefinitions.xml
-rw-r----- 1 root root 2.5K Mar 13 20:51 engine.xml
drwxr-x--- 2 root root 4.0K Mar 13 20:51 definitions
-rw-r----- 1 root root 1.1K Mar 13 20:51 collectors.xml
drwxr-x--- 2 root root 24K Mar 18 03:37 repository

Mari kita rename semua file menjadi dan memiliki extenstion .sample dari list di atas


#rename 's/\.*$/\.sample/' *.*

output

# ls -l
total 116
-rw-r----- 1 root root 1087 Mar 18 03:49 collectors.xml.sample
drwxr-x--- 2 root root 4096 Mar 18 03:49 definitions
-rw-r----- 1 root root 2513 Mar 18 03:49 engine.xml.sample
-rw-r----- 1 root root 234 Mar 18 03:49 eventdefinitions.xml.sample
drwxr-x--- 2 root root 4096 Mar 18 03:49 local
-rw-r----- 1 root root 845 Mar 18 03:49 log4j.conf.sample
-rw-r----- 1 root root 10596 Mar 18 03:49 logalyze-collectors-1.0.xsd.sample
-rw-r----- 1 root root 15970 Mar 18 03:49 logalyze-definitions-1.0.xsd.sample
-rw-r----- 1 root root 6706 Mar 18 03:49 logalyze-engine-config-1.0.xsd.sample
-rw-r----- 1 root root 234 Mar 18 03:49 logdefinitions.xml.sample
-rw-r----- 1 root root 234 Mar 18 03:49 querydefinitions.xml.sample
-rw-r----- 1 root root 234 Mar 18 03:49 reportdefinitions.xml.sample
drwxr-x--- 2 root root 32768 Mar 18 03:49 repository
-rw-r----- 1 root root 233 Mar 18 03:49 repository.defs.xml.sample
-rw-r----- 1 root root 234 Mar 18 03:49 statdefinitions.xml.sample

sekarang kita coba rename semua extension .sample menjadi .txt


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

outputnya

# ls -l
total 116
-rw-r----- 1 root root 1087 Mar 18 03:49 collectors.xml.txt
drwxr-x--- 2 root root 4096 Mar 18 03:49 definitions
-rw-r----- 1 root root 2513 Mar 18 03:49 engine.xml.txt
-rw-r----- 1 root root 234 Mar 18 03:49 eventdefinitions.xml.txt
drwxr-x--- 2 root root 4096 Mar 18 03:49 local
-rw-r----- 1 root root 845 Mar 18 03:49 log4j.conf.txt
-rw-r----- 1 root root 10596 Mar 18 03:49 logalyze-collectors-1.0.xsd.txt
-rw-r----- 1 root root 15970 Mar 18 03:49 logalyze-definitions-1.0.xsd.txt
-rw-r----- 1 root root 6706 Mar 18 03:49 logalyze-engine-config-1.0.xsd.txt
-rw-r----- 1 root root 234 Mar 18 03:49 logdefinitions.xml.txt
-rw-r----- 1 root root 234 Mar 18 03:49 querydefinitions.xml.txt
-rw-r----- 1 root root 234 Mar 18 03:49 reportdefinitions.xml.txt
drwxr-x--- 2 root root 32768 Mar 18 03:49 repository
-rw-r----- 1 root root 233 Mar 18 03:49 repository.defs.xml.txt
-rw-r----- 1 root root 234 Mar 18 03:49 statdefinitions.xml.txt

3 thoughts on “rename file

  1. Unable to load web service objects. Please check if LOGalyze Engine is running and press OK to reload this page.

    this what i am getting plz help me in this

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s