Solved

Copying files with the same extension from a folder with subfolders

Posted on 2004-10-14
9
194 Views
Last Modified: 2010-04-22
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
0
Comment
Question by:akapas
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
9 Comments
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 12314203
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
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 12314255
Cut&paste error... Sorry about this.

find "/Users/desiree/Library/Page Sender/In" -name "*pdf" -exec cp {} /Users/desiree/Desktop/Pdfs \;
0
 

Author Comment

by:akapas
ID: 12315094
Thanks, but didn't work. It says "No such file or directory".

Agi
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 44

Accepted Solution

by:
Karl Heinz Kremer earned 20 total points
ID: 12315127
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
 

Author Comment

by:akapas
ID: 12574449
Sorry, I'm still new here, wasn't sure how to accept.
0
 

Author Comment

by:akapas
ID: 12574791
Thanks. :-)
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question