Rename multiple files in Linux
Tags: files, Linux, rename, Tips
How to rename multiple files in Linux:
Example 1:
ls *.txt | xargs -t -u mv {} {}.old
Example2:
for old in *.txt; do cp $old `basename $old .txt`.doc; done
Example 3:
for i in server*.html; do mv $i ${i/server/servers}; done
Example 4:
for file in *.doc; do mv "$file" "${file%.doc}".txt; done
Example 5:
for file in *.doc; do base=`echo "$file" | sed 's/\.[^.]*$//’`; mv “$file” “$base”.txt; done
Possibly Related Posts:
- RSS Feed Submissions
- Geo Positions
- Interesting about Google Suggest
- Setup a Linux Highly Availability NFS servers
- How to find empty folders on Linux
