writing the more_recent routine is left as a rather complex exercise The regex above will capture the following time stamp styles in $2
16:45:00
Feb 08
2011
Your more_recent routine would have to deal with that (The first is obviously today's the last obviously later so only the middle style requires the use of the Date::Calc module.
I will like to write a script that delete all files that are older than 7 days in a directory and it's subdirectories. Can any one help me out witht the magic command or script?
Thanks in advance,
Odogboly98:confused: (3 Replies)
Hi all,
I want to delete log files with extension .log which are older than 30
days. How to delete those files?
Operating system -- Sun solaris 10
Your input is highly appreciated.
Thanks in advance.
Regards,
Williams (2 Replies)
Hi, I need a .ksh script that lists all the process that are currently running and older than 3 days. once the process list is available i need to mail the list and then kill those processes.
Quick response is highly appreciated :b:
Thanks in Advance!!!
Sri (3 Replies)
Dear all,
i use incremental backup my data with .zip to my hard drive. what i need is i don't want the old .zip file older than 30 days. how to write a shell script automatically remove my external hard disc zip backup folders older than 30 days?
Regards, (2 Replies)
Hi All,
I am trying to automate some stuff to make my 'to-do-things' easier. I am in need for help regarding this.
I have an output
root 17187 3465 0 23:00:00 ? 0:01 Process1
root 4975 4974 0 May 12 ? 0:00 Process2
root 4042 16713 0 Jan 30 pts/22 0:00... (4 Replies)
Hi All,
OS :- HP-UX wm5qa B.11.23 U ia64 1119805695 unlimited-user license
I need to search files older than 50 days. I've used following command in order to search desired files, I also discoverd, it's showing today's files as well. Do you have any clue with this ?
wmqa1> find .... (4 Replies)
Hi All,
I am new to the scripting and using solaris 10 OS. Please suggest me from the below script which modifications need to be done to delete the files more that 2days older. Current script is deleting existing file.
# Remove old explorer runs if needed
DIR=`dirname ${EXP_TARGET}`
if ... (2 Replies)
Hi,
Could someone help me that what the problem is in this code?
#!/bin/sh
FOLDER=/abc/datasource/checkstatus
TIMESTAMP=$(date +%s)
for filename in $(find $FOLDER -maxdepth 1 -type f -name "CHECK_STATUS*"); do
f1=$($filename -Eo "{4}+")
f2=$(date -d "$f1" +%s)
if... (11 Replies)
Discussion started by: Home
11 Replies
LEARN ABOUT DEBIAN
test::mocktime::datecalc
Test::MockTime::DateCalc(3pm) User Contributed Perl Documentation Test::MockTime::DateCalc(3pm)NAME
Test::MockTime::DateCalc -- fake time for Date::Calc functions
SYNOPSIS
use Test::MockTime;
use Test::MockTime::DateCalc; # before Date::Calc loads
# ...
use My::Module::Using::Date::Calc;
DESCRIPTION
"Test::MockTime::DateCalc" arranges for the functions in "Date::Calc" to follow the Perl level "time" function (see perlfunc), and in
particular any fake date/time set there by "Test::MockTime". The following "Date::Calc" functions are changed
System_Clock
Today
Now
Today_and_Now
This_Year
Gmtime
Localtime
Timezone
Time_to_Date
"Gmtime", "Localtime", "Timezone" and "Time_to_Date" are made to default to the Perl-level current "time". When called with an explicit
time argument they're unchanged.
Module Load Order
"Test::MockTime" or similar fakery must be loaded first, before anything with a "time()" call, which includes "Test::MockTime::DateCalc".
This is the same as all "CORE::GLOBAL" overrides, see "OVERRIDING CORE FUNCTIONS" in CORE.
"Test::MockTime::DateCalc" must be loaded before "Date::Calc". If "Date::Calc" is already loaded then its functions might have been
imported into other modules and such imports are not affected by the redefinitions made. For that reason "Test::MockTime::DateCalc"
demands it be the one to load "Date::Calc" for the first time. Usually this simply means having "Test::MockTime::DateCalc" at the start of
a test script, before the things you're going to test.
use strict;
use warnings;
use Test::MockTime ':all';
use Test::MockTime::DateCalc;
use My::Foo::Bar;
set_fixed_time('1981-01-01T00:00:00Z');
is (My::Foo::Bar::something(), 1981);
restore_time();
In a test script it's often good to have your own modules early to check they correctly load their pre-requisites. You might want a
separate test script for that so you don't accidentally rely on "Test::MockTime::DateCalc" loading "Date::Calc" for you.
Other Faking Modules
"Test::MockTime::DateCalc" can be used with other modules which mangle the Perl-level "time" too. For example "Time::Fake",
use Time::Fake; # fakery first
use Test::MockTime::DateCalc;
Or "Time::Mock",
use Time::Mock; # fakery first
use Test::MockTime::DateCalc;
"Time::Warp" (as of version 0.5) only exports a new "time", it's not a core override and so can't be used with "Test::MockTime::DateCalc".
SEE ALSO
Date::Calc, Test::MockTime, Time::Fake, Time::Mock
faketime(1)HOME PAGE
http://user42.tuxfamily.org/test-mocktime-datecalc/index.html
COPYRIGHT
Copyright 2009, 2010 Kevin Ryde
Test-MockTime-DateCalc is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 3, or (at your option) any later version.
Test-MockTime-DateCalc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Test-MockTime-DateCalc. If not, see
<http://www.gnu.org/licenses/>.
perl v5.10.1 2010-09-15 Test::MockTime::DateCalc(3pm)