recursively add file extension to all files

前端 未结 6 1898
盖世英雄少女心
盖世英雄少女心 2020-12-07 07:52

I have a few directories and sub-directories containing files with no file extension. I want to add .jpg to all the files contained within these directories. I\

6条回答
  •  余生分开走
    2020-12-07 08:10

    like this,

    for f in $(find . -type f); do mv $f ${f}.jpg; done
    

    I am not expecting you have space separated file names,
    If you do, the names will need to be processed a bit.

    If you want to execute the command from some other directory,
    you can replace the find . with find /target/directory.

提交回复
热议问题