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 > 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
find & copy files with absolute path jagnikam Shell Programming and Scripting 15 05-15-2008 06:00 PM
need to help to find and copy to a file pujars1 UNIX for Dummies Questions & Answers 2 07-12-2007 09:56 AM
find files and copy into a directory balireddy_77 Shell Programming and Scripting 4 04-27-2007 03:38 AM
Find directories not containing foo, and copy foo to them dkaplowitz Shell Programming and Scripting 6 06-29-2005 08:50 AM
find and copy string in a file vascobrito UNIX for Advanced & Expert Users 10 03-03-2004 02:14 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 05-18-2006
aaajohnson aaajohnson is offline
Registered User
  
 

Join Date: May 2006
Posts: 1
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
  #2 (permalink)  
Old 05-18-2006
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,715
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

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 04:33 PM.


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