How-to rename multiple files in Linux How-to rename multiple files
2013-06-27 15:51
621 查看
原文链接地址:http://www.akaname.org/knowledge/howto-rename-multiple-files-in-linux
How-to rename multiple files in Linux
by Akaname — last
modified May 29, 2011 10:42 PM
Sometimes you need to rename hundreds or thousands of files at once after one and the same scheme. Here are some examples how to rename the files in the linux terminal.
by Akaname — last
modified Jul 04, 2011 04:16 PM
This will rename all *.htm files in the current directory and its subdirectories to *.html files. See the Linux manual pages "man
bash", "man
find", "man
mv", "man
sed" and "man
pcrepattern".
All filename results from find are piped line by line to read and then processed by mv, editing the new filename with sed.
This ensures that all paths with whitespace characters are processed correctly.
by Akaname — last
modified Jul 04, 2011 04:16 PM
This will rename all *.ogg files in the current directory and its subdirectories to *.oga files. See the Linux manual pages "man
bash", "man
find", "man
mv", "man
sed" and "man
pcrepattern".
All filename results from find are piped line by line to read and then processed by mv, editing the new filename with sed.
This ensures that all paths with whitespace characters are processed correctly.
by Akaname — last
modified Jul 04, 2011 04:18 PM
This will add an .old file extension to all files in the current directory, including all subdirectories. See the Linux manual pages "man
bash", "man
find", "man
xargs" and "man
mv".
This will add date and time as a file extension to all files in the current directory, including all subdirectories. Very useful for backups. See the Linux manual pages "man
bash", "man
find", "man
xargs", "man
mv" and "man
date".
How-to rename multiple files in Linux
How-to rename multiple files in Linux
by Akaname — lastmodified May 29, 2011 10:42 PM
Sometimes you need to rename hundreds or thousands of files at once after one and the same scheme. Here are some examples how to rename the files in the linux terminal.
Rename
all .htm files in one directory to .html
by Akaname — lastmodified Jul 04, 2011 04:16 PM
This will rename all *.htm files in the current directory and its subdirectories to *.html files. See the Linux manual pages "man
bash", "man
find", "man
mv", "man
sed" and "man
pcrepattern".
All filename results from find are piped line by line to read and then processed by mv, editing the new filename with sed.
This ensures that all paths with whitespace characters are processed correctly.
find . -type f -name '*.htm' | while read filename; do mv -v "${filename}" "`echo "${filename}" | sed -e 's/\.htm$/\.html/'`"; done
Rename
all .ogg files in one directory to .oga
by Akaname — lastmodified Jul 04, 2011 04:16 PM
This will rename all *.ogg files in the current directory and its subdirectories to *.oga files. See the Linux manual pages "man
bash", "man
find", "man
mv", "man
sed" and "man
pcrepattern".
All filename results from find are piped line by line to read and then processed by mv, editing the new filename with sed.
This ensures that all paths with whitespace characters are processed correctly.
find . -type f -name '*.ogg' | while read filename; do mv -v "${filename}" "`echo "${filename}" | sed -e 's/\.ogg$/\.oga/'`"; done
Add
additional file extension to all files
by Akaname — lastmodified Jul 04, 2011 04:18 PM
This will add an .old file extension to all files in the current directory, including all subdirectories. See the Linux manual pages "man
bash", "man
find", "man
xargs" and "man
mv".
find . -type f -name "*" | xargs -t -i mv {} {}.old
This will add date and time as a file extension to all files in the current directory, including all subdirectories. Very useful for backups. See the Linux manual pages "man
bash", "man
find", "man
xargs", "man
mv" and "man
date".
find . -type f -name "*" | xargs -t -i mv {} {}.`date +%F-%H:%M:%S`
相关文章推荐
- How to show hidden files in ubuntu(linux) :)
- How to Output a List of Files to a File and Sort Them in Linux
- How To Encrypt Files in Linux with eCryptfs
- how to implement the WaitForMultipleObjects in linux
- How to Upload multiple files to documentLibrary in one time
- the diary of how to backup one more files in linux
- How to use logrotate to manage log files in Linux
- How to View MySQL Temp Files and Temp Tables in Linux
- How to Use Rsync to Sync New or Changed/Modified Files in Linux
- How to use logrotate to manage log files in linux(如何在Linux中使用logrotate去管理日志文件)
- How to effectively work with multiple files in Vim?
- How to create and extract zip, tar, tar.gz and tar.bz2 files in Linux
- how to implement WaitForMultipleObjects in linux
- How to attach multiple files in the Send Mail Task in SSIS
- Rename multiple files in Linux (批量重命名)
- How to Delete HUGE (100-200GB) Files in Linux
- How To Get Log, Trace Files In OA Framework Pages And Concurrent Request Programs
- How to integrate Google Calendar in Linux desktop
- How to recover deleted files on Linux
- how to compile and link static/dynamic library in linux