find files with a perticular year of access

Hello all,
Might be a silly question, on my AIX machine the year had changed to 2022 and some files were accessed on this date hence the time stamp on these files is with year 2022, there are many such files. i want to list all these file from the root dir and subdir with 2022 year time stamp. can any one help me on this. i tried using find command with expression but could not frame it.

Kindly help me with this.

Regards,
Pradeep Kulkarni. :rolleyes:

Try this.

find / -exec ls -la {} \; | awk '{ if ( $8==2003) printf $0"\n" }'

Vino

hello Vino,
Thanks for the solution i think it works, and i think i should mention 2022 instead of 2003 in that command right.
ca you do a favour, can you elobrate this command for me i mean explain

Thanks Pradeep

Yes, it should be 2022.

Mea culpa.

find /

Find all file starting from / directory.

-exec ls -la {} \;

For each file found, execute ls -la on that file.

| awk '{ if ( $8==2022) printf $0"\n" }'

Pipe each ls -la to awk. If the eight field is 2022, print the file name.

Look into man find for different possible uses of find.

Vino