Sponsored Content
Top Forums Shell Programming and Scripting Remove excess log files past data mark Post 302912749 by Chubler_XL on Monday 11th of August 2014 04:25:25 PM
Old 08-11-2014
What operating system are you on, as many date manipulation operations can be OS specific?

Do you have a date command that supports the --date option?

Code:
$ date --date "-10 days" +'%Y/%m/%d'
2014/08/02


Last edited by Chubler_XL; 08-11-2014 at 05:34 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to remove log files

Can anyone help me with a shell script to remove all files (log files) created 7 days before current system date. TIA, Kiran. (1 Reply)
Discussion started by: kiranherekar
1 Replies

2. Shell Programming and Scripting

shell script for log files data!

Hi Team, please write a shell script. It is for veritas netbackup logs. The result we currently have is a single file for each day's backups. we will keep the files in the directory and the file names are like below mentioned. example :/opt/openv/netbackup/reports/Daily/NB_success*. The No... (6 Replies)
Discussion started by: rvrao77
6 Replies

3. Solaris

Find 3 months old log files and remove

HI I HAVE LOG FILES IN THIS FORMAT XXX.log.20080509215745 XXX.log.20080209205745 XXX.log.20080301785745 XXX.log.20080109155745 XXX.log.20080409115745 XXX.log.20080309105745 I NEED TO FIND THE FILES FROM 3 MONTHS OLD AND REMOVE PLEASE HELP THANKS, (13 Replies)
Discussion started by: cvdev
13 Replies

4. Shell Programming and Scripting

find files from the past 7 days

Hi All, I have a file which contains the listing of another directory: >cat list.dat -rwxr-xr-x 1 test staff 10240 Oct 02 06:53 test.txtdd -rwxrwxrwx 1 test staff 0 Oct 04 07:22 test.txx -rwxrwxrwx 1 test staff 132 Sep 16 2007 test_tt.sh... (6 Replies)
Discussion started by: deepakgang
6 Replies

5. Shell Programming and Scripting

shell script to remove old files and write to a log file

Hi, I have a script that works on a unix box but am trying to get it working on a linux box that uses shell. I am not a programmer so this is proving harder than I imagined. I made some changes and ended up with the script below but when I run it I get the following messages. Any help would be... (4 Replies)
Discussion started by: yabai
4 Replies

6. Shell Programming and Scripting

Modify log files to get uniq data

Hello, I have a log file that has following output as below. LAP.sun5 CC LAP.sun5 CQ perl.sun5 CC perl.sun5 CQ TSLogger.sun5 CC TSLogger.sun5 CQ TSLogger.sun5 KR WAS.sun5 CC WAS.sun5 MT WAS.sun5 CQ I want to output to be in the way below, i tried using awk but could not do it. ... (12 Replies)
Discussion started by: asirohi
12 Replies

7. Shell Programming and Scripting

Listing files of PAST 7 days and concatenate it...

Hi All, I want to list file of LAST 7 days acc. to its modified date and then concatinate. I have following piece of code.. For concatenate cat file1 file2 >> Output (For concatinating) find . -mtime -7 -exec basename {} \; (list past files but it is including . file also) Plz... (4 Replies)
Discussion started by: vivek1489
4 Replies

8. Shell Programming and Scripting

Can you extract (remove) lines from log files?

I use "MineOS" (a linux distro with python scripts and web ui included for managing a Minecraft Server). The author of the scripts is currently having a problem with the Minecraft server log file being spammed with certain entries. He's working on clearing up the spam. But in the meantime, I'm... (8 Replies)
Discussion started by: nbsparks
8 Replies

9. UNIX for Dummies Questions & Answers

Find command to get the modified files past 2 hours

Hello, How to get the modified/created files past 2 hours in Solaris with find command? Thank you. (7 Replies)
Discussion started by: balareddy
7 Replies

10. Shell Programming and Scripting

How to select all files added to a directory in the past 5 mins (HP-UX)?

Hey everyone, I need to select all files that were added to a specific directory in the past 5 mins and copy them over to a different directory. I am using HP-UX OS which does not have support for amin, cmin, and mmin. B/c of this, I am creating a temp file and will use the find -newer command... (7 Replies)
Discussion started by: mattkoz
7 Replies
DATETIME.SETTIME(3)							 1						       DATETIME.SETTIME(3)

DateTime::setTime - Sets the time

       Object oriented style

SYNOPSIS
public DateTime DateTime::setTime (int $hour, int $minute, [int $second]) DESCRIPTION
Procedural style DateTime date_time_set (DateTime $object, int $hour, int $minute, [int $second]) Resets the current time of the DateTime object to a different time. PARAMETERS
o $object -Procedural style only: A DateTime object returned by date_create(3). The function modifies this object. o $hour - Hour of the time. o $minute - Minute of the time. o $second - Second of the time. RETURN VALUES
Returns the DateTime object for method chaining or FALSE on failure. CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.3.0 | | | | | | | Changed the return value on success from NULL to | | | DateTime. | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 DateTime.setTime(3) example Object oriented style <?php $date = new DateTime('2001-01-01'); $date->setTime(14, 55); echo $date->format('Y-m-d H:i:s') . " "; $date->setTime(14, 55, 24); echo $date->format('Y-m-d H:i:s') . " "; ?> Procedural style <?php $date = date_create('2001-01-01'); date_time_set($date, 14, 55); echo date_format($date, 'Y-m-d H:i:s') . " "; date_time_set($date, 14, 55, 24); echo date_format($date, 'Y-m-d H:i:s') . " "; ?> The above examples will output something similar to: 2001-01-01 14:55:00 2001-01-01 14:55:24 Example #2 Values exceeding ranges are added to their parent values <?php $date = new DateTime('2001-01-01'); $date->setTime(14, 55, 24); echo $date->format('Y-m-d H:i:s') . " "; $date->setTime(14, 55, 65); echo $date->format('Y-m-d H:i:s') . " "; $date->setTime(14, 65, 24); echo $date->format('Y-m-d H:i:s') . " "; $date->setTime(25, 55, 24); echo $date->format('Y-m-d H:i:s') . " "; ?> The above example will output: 2001-01-01 14:55:24 2001-01-01 14:56:05 2001-01-01 15:05:24 2001-01-02 01:55:24 SEE ALSO
DateTime.setDate(3), DateTime.setISODate(3). PHP Documentation Group DATETIME.SETTIME(3)
All times are GMT -4. The time now is 10:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy