HOw to find and copy | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


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 !!

HOw to find and copy

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 05-18-2006
aaajohnson aaajohnson is offline
Registered User
 
Join Date: May 2006
Last Activity: 18 May 2006, 12:42 PM EDT
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
HOw to find and copy

Hi,

I need to find files in a directory, between dates like 4/15/06 and 5/02/06, and copy them to a different directory. Is there a way to doa find and a copy together?

Thanks,

Neil
Sponsored Links
    #2  
Old 05-18-2006
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 24 October 2014, 12:39 PM EDT
Location: NM
Posts: 10,250
Thanks: 282
Thanked 803 Times in 747 Posts
You need to work out the -mtime +<days> and -mtime -<days>
The +<days> = older than, -<days> = younger than


Code:
find /path/to/files -mtime -30 -mtime +13 -print | \
while read file
do
     cp  "$file"  /new/path/`basename "$file"`
done

You may want to mess around with just the first line, until it prints the correct files for you.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Find and copy lol100 Shell Programming and Scripting 1 10-12-2010 06:53 AM
Help with find and copy command bbbngowc Shell Programming and Scripting 2 12-16-2009 03:37 PM
Help with Find All/Copy Script jlfx Shell Programming and Scripting 2 08-31-2008 11:48 AM
need to help to find and copy to a file pujars1 UNIX for Dummies Questions & Answers 2 07-12-2007 09:56 AM
Find directories not containing foo, and copy foo to them dkaplowitz Shell Programming and Scripting 6 06-29-2005 08:50 AM



All times are GMT -4. The time now is 04:32 PM.