LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-17-2008, 04:20 AM   #1
chenboly
LQ Newbie
 
Registered: May 2007
Posts: 7

Rep: Reputation: 0
cp file by date


dear all,
does anyone have experience to copy file in cestos filter by date, example I want to copy file only updated on 17-Apr-2008, how should I use cp command?

Best Regards;
Boly
 
Old 04-17-2008, 04:56 AM   #2
blacky_5251
Member
 
Registered: Oct 2004
Location: Adelaide Hills, South Australia
Distribution: RHEL 5&6 CentOS 5, 6 & 7
Posts: 573

Rep: Reputation: 61
Consider using the command "find" to locate files based on date. Without knowing your full requirements, "find" might suit (or might not).
Code:
find /dir -mtime +1 -exec cp {} /dest/dir/. \;
    or
find /dir -ctime +1 -exec cp {} /dest/dir/. \;
Look at "man find" to work out how to use mtime, ctime or atime.
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
file creation date prashantbhushan Linux - General 2 05-29-2007 08:32 AM
file deletion according to date yongitz Linux - Newbie 4 07-28-2006 06:34 AM
Perl: get file date kenneho Programming 5 11-01-2005 11:16 AM
get date (file) os2 Programming 1 03-07-2005 11:58 AM
ls -al file creation date blackzone Linux - Newbie 2 08-23-2004 01:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration