How do I rename files in sub directories?

前端 未结 15 1340
臣服心动
臣服心动 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 12:06
    In bash use command rename :)
    
     rename 's/\.htm$/.html/' *.htm
    
     # or
    
     find . -name '*.txt' -print0 | xargs -0 rename 's/.txt$/.xml/'
    
     #Obs1: Above I use regex \. --> literal '.'  and  $ --> end of line
     #Obs2: Use find -maxdepht 'value' for determine how recursive is
     #Obs3: Use -print0 to avoid 'names spaces asdfa' crash!
    
    0 讨论(0)
  • 2020-12-04 12:07

    For windows, this is the best tool I've found:

    http://www.1-4a.com/rename/

    It can do anything AND has the kitchen sink with it.

    For Linux, you have a plethora of scripting languages and shells to help you, like the previous answers.

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

    On Windows, The Rename does a pretty good job at that. Freeware, but not open source.

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