find command

Hi!

I was wondering how can I use the command find to select all the files that have the SAME modification date than a given file.

find . -type f  ! -newer filename  -exec ls -l -t {} +

I can only select the files that are newer or that are not (using ! -newer, as the example shows). I want only to select the ones that have the same date.

How can I do this ?

Thanks!

What O/S and version are you running (the "find" command varies)?

Please define exactly what you mean by "the same date". The "find -newer" command matches on a precise date and time down to seconds.

Hi,

I'm using macosx 10.5 and fedora 13.

If there is a file B with the same date (day, year, month, ... seconds) of modification than a given file A... how can I select it with the command file (the file A can also be in the output) ??

thanks

I can't think of an uncomplicated method when we don't seem to have the "stat" command in MACOS to find out the precise timestamp of a file.
Other correspondents may have a method.

Here are the seeds of an idea using the "-ot" and "-nt" shell operators.
The script deduces that a file has the same timestamp as a reference file.
For test purposes we first create two files with the same timestamp.

REFERENCE="my_reference_file"
touch "${REFERENCE}"
touch -f "${REFERENCE}" "my_test_file"
#
find . -type f -print | while read FILENAME
do
if [ ! "${FILENAME}" -ot "${REFERENCE}" -a ! "${FILENAME}" -nt "${REFERENCE}" ]
then
        echo "${FILENAME}"
fi
done