AIX - find command with mtime

Hello experts, I would get from a list of files, which are more ancient than 1 hour. Examples:

Current date:
Wed Oct 28 16:10:02 SAT 2015

using:

find path -name 'file_name. *' -mtime +0

I see files with less at 00:00:00 date of the current day.

/path/file_name.20151027170725
/path/file_name.20151027171225
/path/file_name.20151027171725
/path/file_name.20151027172225

But I need to see the files, less to date:

SAT Wed October 28 2015 15:10:02

So also see files with current date minus 1 hour.

/path/file_name.20151028150725
/path/file_name.20151028150625
/path/file_name.20151028150525
/path/file_name.20151028150425
/path/file_name.20151027170725
/path/file_name.20151027171225
/path/file_name.20151027171725
/path/file_name.20151027172225

then, with the list, I must remove them.

Also, I tried:

find path -name 'file_name. *' -mmin +60

but I see the error:
find: bad option -mmin

Could you tell me which is the variant of the "find" command to use?

I hope I was clear.

Thank you very much for the attention.

Regards.

-mtime +0 means everything before NOW; because no files can reasonably be created in the future (well, touch would allow that, absurdly), it means every file. To confine a time period, use two tests like -mtime +2 -mtime -4 . Tests are ANDed by default. You'd want to consider the -mmin test as well.

You want to read the AIX 'find' command reference and the expression terms with '<x>min' rather than '<x>time' options.

Ref:
https://www-01.ibm.com/support/knowledgecenter/ssw_aix_7/com.ibm.aix.cmds2/find.htm

The '<m>time 'options only have whole day - anywhere between 00:00:00 and 23:59:59 hh:mm:ss - granularity, the '<x>min' options will allow you to specify files over one hour old instead of over one day old.

thanks dukessd.
When I used:

find path -name 'file_name. *' -mmin +60

I see the error:
find: bad option -mmin

The problem is the version of "find" installed?

$ uname -a

HP-UX ccsfgisd B.11.31 U ia64 3021576983 unlimited-user license

---------- Post updated at 08:11 AM ---------- Previous update was at 08:10 AM ----------

thanks rudiC.
When I used:

find path -name 'file_name. *' -mmin +60

I see the error:
find: bad option -mmin

The problem is the version of "find" installed?

$ uname -a

HP-UX ccsfgisd B.11.31 U ia64 3021576983 unlimited-user license

Wong operating system. You said you were working on AIX (which is an operating system developed by IBM). The find -mmin arg feature is an extension to the standards found on AIX and some other operating systems. But, now you tell us you're using HP/UX (which is an operating system developed by Hewlett-Packard), and the find utility supplied on HP/UX does not support that extension.

1 Like

Thanks, you're right, I was wrong OS.

Apologies.

I did not find a HP-UX command that shows the exact file time.
Here perl is used to print the full Unix time,
followed by a loop that compares it with the required reference time:

nowtime=`date +%s`
reftime=$(( nowtime - 3600 ))
find /path -type f -exec perl -le 'for (@ARGV) {print join " ",(stat($_))[9],$_}' {} + |
while read -r ftime fname
do
  if [ $ftime -lt $reftime ]
  then
    echo "$fname"
  fi
done

Excellent!, It works fine!

Thank you very much.