How to find files recursively by file type and copy them to a directory while in ssh?

前端 未结 3 1738
面向向阳花
面向向阳花 2020-12-22 22:46

I would like to find all the pdf files in a folder. It contains pdf files inside and more directories that contain more as well. The folder is loca

相关标签:
3条回答
  • 2020-12-22 23:15

    Try this:

    find . -name "*.pdf" -type f -exec cp {} ./pdfsfolder \;
    
    0 讨论(0)
  • 2020-12-22 23:17

    Paul Dardeau answer is perfect, the only thing is, what if all the files inside those folders are not PDF files and you want to grab it all no matter the extension. Well just change it to

    find . -name "*.*" -type f -exec cp {} ./pdfsfolder \;
    

    Just to sum up!

    0 讨论(0)
  • 2020-12-22 23:23

    Something like this should work.

    ssh user@ip.addr 'find -type f -name "*.pdf" -exec cp {} ./pdfsfolder \;'

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