Vim Tips Wiki
We recommend that you log in before editing. This will allow other users to leave you a message about your edit, and will let you track edits via your Watchlist. Creating an account is quick and free.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 27: Line 27:
 
For example, to rename the files to lowercase:
 
For example, to rename the files to lowercase:
 
<pre>
 
<pre>
:%s/.*/mv -i '&' \L'&'/g
+
:%s/.*/mv -i & \L&/g
 
</pre>
 
</pre>
   
 
To append <code>.orig</code> to each file name:
 
To append <code>.orig</code> to each file name:
 
<pre>
 
<pre>
:%s/.*/mv -i '&' '&.orig'/g
+
:%s/.*/mv -i & &.orig/g
 
</pre>
 
</pre>
   
 
To change all <code>.JPEG</code> extensions to <code>.jpg</code>:
 
To change all <code>.JPEG</code> extensions to <code>.jpg</code>:
 
<pre>
 
<pre>
:%s/.*/mv -i '&' '&'/g
+
:%s/.*/mv -i & &/g
 
:%s/.JPEG$/.jpg/g
 
:%s/.JPEG$/.jpg/g
 
</pre>
 
</pre>
Line 43: Line 43:
 
To remove duplicate extensions:
 
To remove duplicate extensions:
 
<pre>
 
<pre>
:%s/.*/mv -i '&' '&'/g
+
:%s/.*/mv -i & &/g
 
:%s/.jpg.jpg$/.jpg/g
 
:%s/.jpg.jpg$/.jpg/g
 
</pre>
 
</pre>
Please note that all contributions to the Vim Tips Wiki are considered to be released under the CC-BY-SA
Cancel Editing help (opens in new window)