LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   cp file by date (https://www.linuxquestions.org/questions/linux-general-1/cp-file-by-date-635927/)

chenboly 04-17-2008 04:20 AM

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

blacky_5251 04-17-2008 04:56 AM

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.


All times are GMT -5. The time now is 01:34 PM.