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 Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Search files between a date range zcanji Shell Programming and Scripting 7 05-27-2009 12:31 PM
How to display files that have been modifed between a given date range prathima UNIX for Dummies Questions & Answers 1 04-02-2008 11:24 AM
Script that can Copy a Range of files from Tape to Hard disk msjazzie Shell Programming and Scripting 0 08-13-2007 03:47 PM
cp only files in certain date range ee7klt UNIX for Dummies Questions & Answers 1 06-27-2005 09:35 PM
Moving Files within a particular date range rooh UNIX for Dummies Questions & Answers 3 03-18-2002 10:59 AM

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 Rating: Thread Rating: 1 votes, 4.00 average. Display Modes
  #1 (permalink)  
Old 05-15-2008
geauxsaints geauxsaints is offline
Registered User
  
 

Join Date: May 2008
Posts: 4
Question How can i copy files by date last modifed range?

When I do a ls -lt I get a list of files by date modified from newest to oldest. I would like to be able to copy some files to another directory using a date last modified range (i.e. Apr 30 - May 13) How could I do this?

Thanks,
Joe
  #2 (permalink)  
Old 05-15-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
find has an option in most versions to pick files by age, or you could simply note the first and last files in the range and pipe ls -t output to a sed script to pick out that range.
  #3 (permalink)  
Old 05-15-2008
Danny.Chouinard Danny.Chouinard is offline
Registered User
  
 

Join Date: May 2008
Posts: 21
You can also tell find to find files that are newer than one file.
Code:
find . -type f -newer timestamped_file -print
will print all the files that were modified since the last time timestamped_file was modified.

man find reveals all.

Last edited by Yogesh Sawant; 05-16-2008 at 07:23 AM.. Reason: added code tags
  #4 (permalink)  
Old 05-15-2008
geauxsaints geauxsaints is offline
Registered User
  
 

Join Date: May 2008
Posts: 4
I ended up using just adding a -exec cp {} ./mydir \; to the end of the find command and it worked like a charm. Thanks for help!
  #5 (permalink)  
Old 05-25-2008
AbhishekG AbhishekG is offline
Registered User
  
 

Join Date: May 2008
Posts: 7
hi
you can use find command with -mtime flag

like
find . -mtime (-n or n or +n) | xargs cp dirname

-n for files modified in last n days
n for files modified exactly on last nth day
+n fro files modifed before last nth day

Abhishek Gera
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 10:33 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