The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Copy unique files between two directories in Solaris sujoy101 Shell Programming and Scripting 2 03-21-2008 11:59 PM
Copy single file to multiple directories kthatch UNIX for Dummies Questions & Answers 2 11-11-2007 03:10 PM
get files from multiple directories using FTP amit1209 Shell Programming and Scripting 2 09-26-2007 06:39 AM
How do copy certain files and directories from one hard drive to another? shorty UNIX for Dummies Questions & Answers 4 02-11-2006 05:26 PM
FTP multiple files to different directories abrd600 Shell Programming and Scripting 12 09-23-2004 04:56 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 03-23-2007
Registered User
 

Join Date: Mar 2007
Posts: 2
copy multiple files in different directories

I have a report file that is generated every day by a scheduled process.
Each day the file is written to a directory named .../blah_blah/Y07/MM-DD-YY/reportmmddyy.tab

I want to copy all of this reports to a separate directory without having to do it one by one.

However, if I try

cp .../blah_blah/Y07/*/report*.tab /new_directory/report*.tab

I get "cannot create /new_directory/report*.tab: no such file or directory"

however,

ls .../blah_blah/Y07/*/report*.tab

displays all the files I want to copy.

How do I do this? Thanks.
Reply With Quote
Forum Sponsor
  #2  
Old 03-23-2007
Registered User
 

Join Date: Mar 2007
Posts: 2
nevermind

duh, all i needed to do was:

cp .../blah_blah/Y07/*/report*.tab /new_directory/
Reply With Quote
  #3  
Old 03-24-2007
Registered User
 

Join Date: Mar 2007
Posts: 3
Copying files from multiple directories

If you are interested, this is a solution that I used to copy *.m4a files from multiple directories into a new directory:

find . -name "*.m4a" -exec cp "{}" /<dir> \;

This will search for any occurrance of *.m4a in the current directory and any subdirectory and move them to the specified directory.
Reply With Quote
  #4  
Old 03-25-2007
Registered User
 

Join Date: Mar 2007
Location: Chennai
Posts: 222
Use cp -r

I think cp -r <from> <to> can be used in this case.

Thanks
Nagarajan Ganesan
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:12 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0