06-30-2002
Use the "date" command to get the current date and time. Then subtract 2 from the hours. This may require adjusting the date if you are close to midnight. Once you have the date and time of 2 hours ago, use the "touch" command to create a temp file with that mtime. Next, use the "find" command is get a list of files older than the temp file and delete them. Finally, remove that temp file.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I want to write a sh script that will find files older than 2 hours and tar them. I've had a look at the find man page but can't see how to do it by hours.
Help please.
Thanx (1 Reply)
Discussion started by: ianf
1 Replies
2. Shell Programming and Scripting
Hi,
I know I can use touch and find's "! -newer" option to list files that are older than a specific time, but what is a good way to get a list of files that are over 12 hours old?
The log pruner will run throughout the day, twice an hour. So I can't easily use a cronjob touch command to generate... (1 Reply)
Discussion started by: Thomas Pluck
1 Replies
3. Shell Programming and Scripting
What is the command to remove files that are generated 6 hours or older? The find and remove tells only how to remove if the file is one day old or more. Appreciate quick reply. Thanks (3 Replies)
Discussion started by: gthokala
3 Replies
4. Shell Programming and Scripting
I need a script which list the files which is starting with the word heap*** and that is created before past 24 hours.I need the script using find command. please help me on this. (1 Reply)
Discussion started by: jayaramanit
1 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I want to setup a cronjob that will delete logs every 2 hours. I have script that delete logs per day. but logging is too big and i want to run a conjob that will delete every 2 hours.
this is my current command but it deletes on a per day basis.
find . -name "*.log*" -o -name... (3 Replies)
Discussion started by: tungaw2004
3 Replies
6. Shell Programming and Scripting
I need to be able to do the following:
Find files in multiple directories that are 6 hours older than the current time?
I am using KSH
I tried mmtime but it was not a valid option
Any help would be great. Thank you! (2 Replies)
Discussion started by: llsmr777
2 Replies
7. Shell Programming and Scripting
Hi Frens,
I want to list some files from a directory, which contains "DONE" in their name, i am receiving files every minute. In this i want to list all the files which are newer than 6 hours but older than 3 hours, of current time
i dont want my list to contain the latest files which are ... (4 Replies)
Discussion started by: Prat007
4 Replies
8. Shell Programming and Scripting
Hi All
I need to know the command which can be used to list the files which are 3 hours old so that it can be deleted. (3 Replies)
Discussion started by: mskalyani9
3 Replies
9. Shell Programming and Scripting
How do I list al files in a folder with a creation date/time newer than 6 hours? (2 Replies)
Discussion started by: locoroco
2 Replies
10. Shell Programming and Scripting
How to Deleting Files Older than 1 hours.
Base on SunOS.
this file gen every 1 min.
-rw-r--r-- 1 nobody nobody 4960 Jan 27 02:02 23_201301270201.log
-rw-r--r-- 1 nobody amudu 2325 Jan 27 02:03 33_201301270202.log
-rw-r--r-- 1 nobody amudu 3255 Jan 27 02:03... (2 Replies)
Discussion started by: ooilinlove
2 Replies
LEARN ABOUT SUSE
alevt-date
ALEVT-DATE(1) Teletext time ALEVT-DATE(1)
NAME
alevt-date - display/set time received via Teletext
SYNOPSIS
alevt-date [options]
DESCRIPTION
alevt-date displays the time received from a Teletext source. It can be used to set the system time. The date is not interpreted (not
even transmitted on most channels). So it allows only adjustment of +/-12 hours. The default allowed adjustment is limited to +/-2 hours
(use -delta to change). Without the -set option it just displays the date in the format of the date(1) command.
OPTIONS
A summary of options is included below.
-set Set system time from time received via Teletext.
-delta seconds Maximum allowed adjustment made to the system time. The default is 7200 seconds (2 hours) and the maximum that may be
given is 12 hours.
-format string Format string to used to print the time. Look at strftime(3) for possible control sequences.
-vbi device Use the given device name (default: /dev/vbi0).
-timeout seconds If the time can't be detected in seconds, the program is terminated with a SIGALRM.
--help Show summary of options.
--version Show version of program.
Before starting this program, you have to set the TV channel with another program like xawtv of set-tv.
Note: This program does not set the battery backed up clock of your computer. clock -w will do this.
FILES
/dev/vbi*
SEE ALSO
alevt(1x), alevt-cap(1), strftime(3), date(1), clock(8).
BUGS
This program is just a toy. The time transmitted by the TV stations is more than inaccurate. Some are within a few seconds of your local
time reference but others are more then 15 minutes off. You've been warned. (And don't assume the pkt8/30 time is better. It's even
worse.)
No bug reports to <froese@gmx.de> *g*.
LINUX
1.6.2 ALEVT-DATE(1)