I am having following folder structure.

applications (main directory)
  - 1 (sub directory)
  - 2 
  - 3

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/"
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).

| improve this answer | |

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.