The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
list the files but exclude the files in subdirectories shyjuezy UNIX for Dummies Questions & Answers 8 10-15-2008 01:42 PM
Listing subdirectories and files senthil_is Shell Programming and Scripting 1 05-24-2008 07:38 AM
Listing all files in all subdirectories kuciauskas UNIX for Dummies Questions & Answers 3 02-01-2008 05:45 PM
tar subdirectories for specific files ronald_brayan UNIX for Advanced & Expert Users 4 10-12-2006 05:53 AM
Searching files within subdirectories jalvarez UNIX for Dummies Questions & Answers 1 09-08-2003 04:12 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-03-2005
iomaire iomaire is offline
Registered User
  
 

Join Date: Sep 2005
Posts: 6
copy certain files from subdirectories

Hi all,
I'd very grateful for some help with the following.

I have a variable number of subdirectories each of which contain a uniquely names results file of the form Results*.dat.

I would like to search through all subdirectories and copy out these results file to another directory so that I can combine them, diff them etc.

find . -name Results*.dat

will find all the files for me. How should I pass this to cp (copy)?

Thanks,
E
  #2 (permalink)  
Old 10-03-2005
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
Code:
find . -name Results*.dat -exec cp {} /destination/dir \;
Read the man page for -exec

vino
  #3 (permalink)  
Old 10-05-2005
iomaire iomaire is offline
Registered User
  
 

Join Date: Sep 2005
Posts: 6
Thanks very much
  #4 (permalink)  
Old 10-06-2005
pixelbeat pixelbeat is offline
Registered User
  
 

Join Date: Jun 2005
Location: Ireland
Posts: 61
find dir/ -name 'Results*.dat' | xargs cp -a --target-directory=/dest/dir --parents
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:45 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0