Solved

Copying files with the same extension from a folder with subfolders

Posted on 2004-10-14
9
191 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
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help Linux centos 5.7 3 87
predeployment and postdeployment script in linux rpm 1 28
usage of %{name} in rpm spec file 4 49
linux / python expert needed 3 88
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…
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

920 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

15 Experts available now in Live!

Get 1:1 Help Now