小编use*_*532的帖子

Bash, run script on every .jpg file in a directory with subdirectories

I have some working code, it's very simple - it copies every*.jpg file, renames it into*1.jpg, no worries.

for i in *.jpg; do cp $i ${i%%.jpg}1.jpg;  done
Run Code Online (Sandbox Code Playgroud)

how can I run this, so that it works on every file in a directory, every file in the subdirectories of that directory

example directory structure:

    test/test1/test2/somefile.jpg
    test/anotherfile.jpg
    test/test1/file.jpg
etc
Run Code Online (Sandbox Code Playgroud)

unix bash

5
推荐指数
1
解决办法
3963
查看次数

标签 统计

bash ×1

unix ×1