I use AIX via telnet here at work, and I\'d like to know how to find files in a specific folder between a date range. For example: I want to find all files in folder X that were
Use stat
to get the creation time. You can compare the time in the format YYYY-MM-DD HH:MM:SS
lexicographically.
This work on Linux with modification time, creation time is not supported. On AIX, the -c
option might not be supported, but you should be able to get the information anyway, using grep
if nothing else works.
#! /bin/bash
from='2013-08-01 00:00:00.0000000000' # 01-Aug-13
to='2013-08-31 23:59:59.9999999999' # 31-Aug-13
for file in * ; do
modified=$( stat -c%y "$file" )
if [[ $from < $modified && $modified < $to ]] ; then
echo "$file"
fi
done