![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| 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 !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| files between any two given dates | thanuman | UNIX for Dummies Questions & Answers | 8 | 12-05-2007 11:16 PM |
| Files and dates | mastachef | UNIX for Dummies Questions & Answers | 1 | 12-03-2007 11:12 AM |
| Files created in last 24 hours | jayaramanit | Shell Programming and Scripting | 1 | 09-08-2007 01:34 AM |
| Files created by particular user | Anshu | UNIX for Dummies Questions & Answers | 2 | 06-13-2006 05:12 AM |
| Two Files Created For Every One? | Atama | UNIX for Dummies Questions & Answers | 1 | 04-12-2002 01:44 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Copy only files created between two dates
Hi all,
I like to get two date values from command line, and I have to copy all the files created in between that dates in a particular folder to destination folder. The date comparison is little bit consusing me. Please help. Regards Sethu. |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Hey,
U can refer this link http://www.unix.com/tips-and-tutoria...n-in-bash.html This has some methods for calculating the date difference. Thanks |
|
#3
|
||||
|
||||
|
Quote:
You should do something on the following lines. Code:
#! /bin/sh # # Input: 2 parameters <from_date> <new_date> # touch -d <from_date> /tmp/temp.file find /path/to/search -newer /tmp/temp.file -type f 2>/dev/null >/tmp/file.from touch -d <new_date> /tmp/temp.file find /path/to/search -newer /tmp/temp.file -type f 2> /dev/null >/tmp/file.new grep -v -f /tmp/file.new /tmp/file.from > /tmp/file.list for file in $(< /tmp/file.list) do /bin/cp $file /destination/folder done rm -f /tmp/file.list /tmp/file.new /tmp/file.from /tmp/temp.file |
||||
| Google The UNIX and Linux Forums |