![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Finding modified File List after the chosen date in Korne Shell... | marconi | Shell Programming and Scripting | 2 | 01-22-2008 02:27 AM |
| Finding only those files older than 2 hours | mh53j_fe | UNIX for Dummies Questions & Answers | 2 | 07-01-2005 06:33 AM |
| Finding modified files | rhayabusa | UNIX for Dummies Questions & Answers | 2 | 12-16-2004 10:48 AM |
| finding date and time after 3 hours | svannala | High Level Programming | 2 | 09-07-2003 08:07 PM |
| Finding files older than 2 hours | ianf | Shell Programming and Scripting | 1 | 05-27-2002 07:51 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
finding the file which is modified within last 2 hours
hi,
I want to find a file which is modified within last 2 hours i am using sun-os i tried find . -name <filename> -mmin 120 i found that mmin option is not supported in sun-os is there any other alternative option suggestions welcome thanks in advance |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
You need perl, python or C - here is perl
Code:
#!/bin/ksh
secs()
{
perl -e '
$mtime = (stat $ARGV[0])[9];
$diff = time() - $mtime;
if ($diff > ( $ARGV[1] * 3600 ))
{
print "1";
}
else
{
print "0";
}
' $1 $2
}
hours=2
for file in `ls *.pl`
do
older=$(secs $file $hours)
if [[ $older -eq 1 ]] ; then
echo "$file is older"
else
echo "$file is not older"
fi
done
|
|
#3
|
|||
|
|||
|
please try the mtime option. check the man page of find.
|
|
#4
|
||||
|
||||
|
With zsh:
Code:
print -l **/*(.mh-2) |
||||
| Google The UNIX and Linux Forums |