All,
How to get the list of files through a unix command which exists / created / updated between 8 PM to 11:59 PM from a particular location.
Regards
Oracle User
All,
How to get the list of files through a unix command which exists / created / updated between 8 PM to 11:59 PM from a particular location.
Regards
Oracle User
#!/bin/sh
export LC_ALL=C
nowdate=`date '+mon=%b day=%e'`
# date '+%b %e'
# must be the same format as
# ls -l
# field 6 and 7
ls -ltr | awk '{split($8,t,":")} $6==mon && $7==day && t[1]>=20 && t[1]<=23' $nowdate
The default action is {print}
.
If you want only the file names, use {print $9}
ls -ltr | awk '{split($8,t,":")} $6==mon && $7==day && t[1]>=20 && t[1]<=23 {print $9}' $nowdate
or
touch -t 201305170859 dummy1
touch -t 201305172359 dummy2
find /location -type f \( -newer dummy1 -a ! -newer dummy2 \)
Nice idea
Better readable and with the OP's start time:
touch -t 201305172000 start_time
touch -t 201305172359 end_time
find /location -type f \( -newer start_time -a \! -newer end_time \)