Solved

Copying files with the same extension from a folder with subfolders

Posted on 2004-10-14
9
190 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
  • 3
  • 3
9 Comments
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks, but didn't work. It says "No such file or directory".

Agi
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 44

Accepted Solution

by:
Karl Heinz Kremer earned 20 total points
Comment Utility
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
Comment Utility
Sorry, I'm still new here, wasn't sure how to accept.
0
 

Author Comment

by:akapas
Comment Utility
Thanks. :-)
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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 demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now