Help on find -mtime -exec

Hello people.
Part of my script:

echo "Compressing files older than 2 months in ${TEMP_DIR} directory ..."
find ${DATA_DIR}/ -name '*.dat' -mtime 61 -exec compress {} \;

#BELOW COMMAND DOES NOT WORK :-(  <<<<<<-----------
find ${DATA_DIR}/ -name '*.o.lines.*' -mtime 61 -exec compress {} \;
#

echo "Files compressed:"
ll ${DATA_DIR}/*.Z | wc -l
echo
echo "Moving compressed files from ${DATA_DIR} to ${TEMP_DIR} directory ..."
mv ${OSS_DIR}/*.Z ${BACKUP_DIR}

While the first find command works perfect, the second find will not compress the files in the dir that contains ".o.lines." in the name of the file. Any idea why this is happening ?

Thank you in advance

"-mtime 61" will only find files which are exactly 61 days old.
Maybe try with "-mtime +60" ?

1 Like

Thank you. I just figured out that the required files cannot be compressed :slight_smile: