Copy nested folders contents to one folder recursively (terminal)

前端 未结 3 1641
被撕碎了的回忆
被撕碎了的回忆 2021-01-30 11:23

I have a Wordpress upload folder that is structured using subfolders for months.

wolfr2:uploads wolfr$ tree .
.
|-- 2007
|   |-- 08
|   |   |-- beautifulkatamari         


        
3条回答
  •  深忆病人
    2021-01-30 12:14

    This will copy all *.jpg files from the current folder to a new folder and preserve the directory structure.

    tar cvfp `find . -name "*.jpg"` | (cd ; tar xfp -)
    

    To copy without preserving the directory structure:

    cp `find . -name "*.jpg"` 
    

提交回复
热议问题