make getpeername() return the original socket address which before it was intercepted
[hband-tools.git] / user-tools / findnewestfile
blobcb86c0f3293d96191f511385e07122494445e7a8
1 #!/bin/bash
3 self=${0##*/}
4 gts=-1
5 lts=-1
8 if expr "$self" : ".*old" >/dev/null
9 then
10 # findOLDESTfile
11 find "$@" -type f -printf "%T@ %p\n" | while read ts fn
13 ts=${ts%.*}
14 if [ $lts -eq -1 -o $ts -lt $lts ]
15 then
16 lts=$ts
17 echo `date -d @$lts` "$fn"
19 done
20 else
21 # findNEWESTfile
22 find "$@" -type f -printf "%T@ %p\n" | while read ts fn
24 ts=${ts%.*}
25 if [ $gts -eq -1 -o $ts -gt $gts ]
26 then
27 gts=$ts
28 echo `date -d @$gts` "$fn"
30 done
34 true <<EOF
36 =pod
38 =head1 NAME
40 findnewestfile - Search for the newest file in a given path recursively and always show the most recent while scanning
42 findoldestfile - Search for the oldest file in a given path recursively and always show the most older while scanning
44 =head1 SYNOPSIS
46 findnewestfile [B<path>]
48 findoldestfile [B<path>]
50 =head1 DESCRIPTION
52 Search for the newest/oldest file in given directory and in its subdirectories
53 showing files immediately when found one newer/older than the past ones.
55 =cut
57 EOF