0

I am having following folder structure.

applications (main directory)
  - 1 (sub directory)
    application_1.pdf
  - 2 
    application_2.pdf
  - 3
    application_3.pdf

I wanted to copy all the application_*.pdf pattern files to a single directory. How to achieve that with shell script?

so far I have tried following but it copies all the subdirectories as well

cp -r "$path_src/" "$path_dst/"
1
cp applications/*/application_*.pdf /destination/path/

This would copy all the PDF files matching application_*.pdf in any subdirectory of applications into /destination/path/. This relies on all PDF files having unique names (as to not "collide" in the destination directory).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.