Copying files with the same extension from a folder with subfolders

Hi,

I'd like to copy all the pdfs that reside within all the folders withing one folder.I tried this, but it didn;t work. It says 'no match'.

cp -r /Users/desiree/Library/Page\ Sender/In/*.pdf /Users/desiree/Desktop/Pdfs

The computer is an OS X machine not Linux, but that didn't seem to matter much with other commands. :-)

Any ideas?

Thanks,
agi
akapasAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Karl Heinz KremerConnect With a Mentor Commented:
Try
find /Users/desiree/Library/Page\ Sender/In -name "*.pdf"  -exec cp {} /Users/desiree/Desktop/Pdfs \;


If you still get this error message, try to just list the PDF file names:
find /Users/desiree/Library/Page\ Sender/In -name "*.pdf"  -print

Does this work?
0
 
Karl Heinz KremerCommented:
find . -name "/Users/desiree/Library/Page\ Sender/In/*pdf" -exec cp {} /Users/desiree/Desktop/Pdfs \;

The copy command does not recursively copy files, you need to call find first to search for all PDF files, and then copy the files that were found.

0
 
Karl Heinz KremerCommented:
Cut&paste error... Sorry about this.

find "/Users/desiree/Library/Page Sender/In" -name "*pdf" -exec cp {} /Users/desiree/Desktop/Pdfs \;
0
[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

 
akapasAuthor Commented:
Thanks, but didn't work. It says "No such file or directory".

Agi
0
 
akapasAuthor Commented:
Sorry, I'm still new here, wasn't sure how to accept.
0
 
akapasAuthor Commented:
Thanks. :-)
0
All Courses

From novice to tech pro — start learning today.