|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | 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 Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Script to copy files from a certain date
I need to copy files from a directory that has a lot of files in it. However I only want to copy them from a certain date. My thoughts so far are to use ls -l and to pipe this into awk and print out tokens 6 (month)and 7 (day). Code:
$ ls -l -rw-r--r-- 1 prodqual tst 681883 Jun 12 05:31 test1.txt -rw-r--r-- 1 prodqual tst 681884 Jun 13 07:35 test2.txt -rw-r--r-- 1 prodqual tst 681885 Jun 13 07:36 test3.txt I'm not sure how to do this. I was hoping that if I enter the following on the cmd line: Code:
cp script month day outputfile If this is not possible I could manually enter the month and day into the script. |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
You can use find command. e.g., Assuming the date to be '1-Jan-2010' You could do this: Code:
touch -t 1001011305 a # Create a dummy file with the required date time stamp (1-jan-2010)
find \( -newer a \) -exec cp {} target_dir \; # Find all files newer than the dummy file and move to target dirLast edited by jawsnnn; 06-13-2012 at 08:00 AM.. |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
Quote:
|
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help with script to copy/rename files, then delete by date | Lucid13 | Shell Programming and Scripting | 4 | 04-05-2012 02:10 PM |
| Script to copy log files with today's date | mdncan | Shell Programming and Scripting | 3 | 12-30-2008 01:14 PM |
| script to rename files with current date and copy it. | logic0 | UNIX for Dummies Questions & Answers | 6 | 05-01-2007 05:13 AM |
| copy files with date | isingh786 | HP-UX | 1 | 03-10-2006 04:04 PM |
|
|