How do I rename files in sub directories?

前端 未结 15 1339
臣服心动
臣服心动 2020-12-04 11:10

Is there any way of batch renaming files in sub directories?

For example:

Rename *.html to *.htm in a folder which has directories

相关标签:
15条回答
  • 2020-12-04 11:55

    For Windows, I've made a convenient litte VBScript solution with regex-based renaming and Drag&Drop support. Give it a try if you like - put it in a vbs file and drop your folder on it in Explorer.

    0 讨论(0)
  • 2020-12-04 11:56
    find . -regex ".*html$" | while read line;
     do 
        A=`basename ${line} | sed 's/html$/htm/g'`;
        B=`dirname ${line}`;
        mv ${line} "${B}/${A}";
     done
    
    0 讨论(0)
  • 2020-12-04 12:01

    In Bash, you could do the following:

    for x in $(find . -name \*.html); do
      mv $x $(echo "$x" | sed 's/\.html$/.htm/')
    done
    
    0 讨论(0)
  • 2020-12-04 12:02

    On Windows, you can find out opensource simple C# bulk file renamer application in https://filerenamer.codeplex.com works with a simple excel file. Give an excel file with two columns source and destination to this application and it's done.

    0 讨论(0)
  • 2020-12-04 12:03

    If you have forfiles (it comes with Windows XP and 2003 and newer stuff I think) you can run:

    forfiles /S /M *.HTM /C "cmd /c ren @file *.HTML"

    0 讨论(0)
  • 2020-12-04 12:05

    On Linux, you may use the 'rename' command to rename files in batch.

    0 讨论(0)
提交回复
热议问题