How do I rename files in sub directories?

前端 未结 15 1418
臣服心动
臣服心动 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:54

    I'm sure there's a more elegant way, but here's the first thing that popped in my head:

    for f in $(find . -type f -name '*.html'); do 
        mv $f $(echo "$f" | sed 's/html$/htm/')
    done
    

提交回复
热议问题