Sponsored Content
Top Forums Shell Programming and Scripting List files created before Noon 2 days prior Post 302159774 by prismtx on Friday 18th of January 2008 02:12:23 PM
Old 01-18-2008
List files created before Noon 2 days prior

Our nightly updates run in the evening and finish around 8am. My boss wants the current log files kept on the server for 2 days, but wants anything created before noon, 2 days prior archived. I was thinking of using touch to set a temporary file with a date of today-2 and a time of noon, then moving anything older to an archive directory. My problem is that I can't find a way to set the date. Any ideas, or a better way to do it?

Here is what I have for anything prior to noon today, but cant get noon of 2 days ago figured out.

REF=.tmp.$$
TARGETDIR=/export/home/Archive
touch -t $(date +%m%d)1200 $REF # today at Noon
find . ! -newer $REF -exec cp -p {} $TARGETDIR \;
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Deleting files created before two days ago

Dear All: I want to build a shell that delete files created two or more days ago ... I think it could be built using a special command with ls or grep, I'd apreciate any help from you guys I have a lot of log files from november, december, january and this tool will help me a lot The files... (3 Replies)
Discussion started by: josecollantes
3 Replies

2. Solaris

command to list files that are created before some date

Can you please let me know the command to list the files that are created before some date, this we want to use for the following Eg: Move all the files that got created before 2006 to new folder in Solaris (3 Replies)
Discussion started by: csreenivas
3 Replies

3. Shell Programming and Scripting

Remove files which created date before 10 days on HP-UX

Hi All, Could you please let me know if there is any one can help to create a shell script to remove some files which is the created date for them greate than 10 days (sysdate-10) Please try to email me on email removed Thanks in advance, Murad (1 Reply)
Discussion started by: murad_fayez
1 Replies

4. UNIX for Dummies Questions & Answers

How to list files Created in last 2 hrs

I wanted to know what command should I use to see the files created in last 2 hours in a given directory. I know to see the files changed in last one day I can use this: find /admin//dump -type f -ctime -1 -print | xargs ls -lt|pg However I am not getting what should I use if I wanted tol... (4 Replies)
Discussion started by: rsonakiya
4 Replies

5. UNIX for Advanced & Expert Users

File disk utilization for 10 days prior

Hi I have a requirement to list the files & the total disk utilization they have which are 10 prior to current date. I tried couple of options in combinations of find mtime, ctime with du -m, but no luck. Could you please help me in this ? (2 Replies)
Discussion started by: videsh77
2 Replies

6. UNIX for Dummies Questions & Answers

moving files prior to 2 days

Hi All, I have a question. i have a directory say /home/pavi/logs ls -ltr gives all the files in the /home/pavi/logs directory. i am trying to move only those files existing in this folder prior to 2 days. i.e files exiting say May 9th and May 8th remain in this directory but all the... (12 Replies)
Discussion started by: pavan_test
12 Replies

7. UNIX for Dummies Questions & Answers

How to find files created some days before?

HI, I have 2 questions. 1> Is there any code to see files that created some day or some time before in a directory??? 2> how or where i will find the last exit status of a process?? thanks (6 Replies)
Discussion started by: jyotidas
6 Replies

8. Shell Programming and Scripting

what is the find to command to find the files created last 30 days

what is the find to command to find the files created last 30 days (5 Replies)
Discussion started by: rajkumar_g
5 Replies

9. Shell Programming and Scripting

Find the sum of files created 5 days before

Hi, I want to find the sum of all the files created 5 days ago and store it in a variable. (os is HP-UX) can this be extracted from ls -l Is there any other way of getting the sum of all the files created (4 Replies)
Discussion started by: bang_dba
4 Replies

10. Linux

List all files created today exclude last one

Hi, ALL thanks in advance, i listed all files using this command ls -ltr $(date +%Y%m%d)*.xmlbut i would like to exclude the last one created ; Best regard MEROUAN Use code tags, thanks. (4 Replies)
Discussion started by: merouan
4 Replies
NNGOBACK(1)						      General Commands Manual						       NNGOBACK(1)

NAME
nngoback - make news articles unread on a day-by-day basis (nn) SYNOPSIS
nngoback [ -NQvi ] [-d] days [ group ]... DESCRIPTION
nngoback will rewind the .newsrc record file of nn(1) one or more days. It can be used to rewind all groups, or only a specified set of groups. In other words, nngoback can mark news articles which have arrived on the system during the last days days unread. Only subscribed groups that occur in the current presentation sequence are rewound. That means that if no group arguments are specified, all groups occurring in the sequence defined in the init file will be rewound. Otherwise, only the groups specified on the argument line will be rewound. When a group is rewound, the information about selections, partially read digests etc. are discarded. It will print notifications about this unless the -Q (quiet) option is used. If the -i (interactive) option is specified, nngoback will report for each how many articles can be marked unread, and ask for confirmation before going back in that group. If the -v (verbose) option is specified, nngoback will report how many articles are marked unread. If the -N (no-update) option is specified, nngoback will perform the entire goback operation, but not update the .newsrc file. If you are not up-to-date with your news reading, you can also use nngoback to catch up to only have the last few days of news waiting to be read in the following way: nn -a0 nngoback 3 The nn command will mark all articles in all groups as read (answer all to the catch-up question.) The following nngoback will then make the last three days of news unread again. Examples: nngoback 0 Mark the articles which have arrived today as unread. nngoback 1 Mark the articles which have arrived yesterday and today as unread. nngoback 6 Mark the articles which have arrived during the last week as unread. You cannot go more than 14 days back with nngoback. (You can change this limit as described below.) THE BACK_ACT DAEMON It is a prerequisite for the use of nngoback that the script back_act is executed at an appropriate time once (and only once) every day. Preferably this is done by cron right before the bacth of news for `today' is received. back_act will maintain copies of the active file for the last 14 days. Optionally, the back_act program accepts a single numerical argument specifying how many copies of the active file it should maintain. This is useful if news is expired after 7 days, in which case keeping more than 7 days of active file copies is wasteful. FILES
~/.newsrc The record of read articles. ~/.newsrc.goback The original rc file before goback. $db/active.N The N days `old' active file. $master/back_act Script run by cron to maintain old active files. SEE ALSO
nn(1), nncheck(1), nngrab(1), nngrep(1), nnpost(1), nntidy(1) nnadmin(1M), nnusage(1M), nnmaster(8) NOTES
nngoback does not check the age of the `old' active files; it will blindly believe that active.0 was created today, and that active.7 is really seven days old! Therefore, the back_act script should be run once and only once every day for nngoback to work properly. The days are counted relative to the time the active files were copied. AUTHOR
Kim F. Storm, Texas Instruments A/S, Denmark E-mail: storm@texas.dk 4th Berkeley Distribution Release 6.6 NNGOBACK(1)
All times are GMT -4. The time now is 02:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy