Some examples of this command from Linux Debian and FreeBSD

 

Here is how to do this with GNU Linux – %p gives full path name

 

user1@f1-google-joniowa:~$ find . -name "weather_obs.log"  -printf "%p\t%TY-%Tm-%Td\n"
./test27/weather_obs/weather_obs.log    2023-05-16
./test26/weather_obs/weather_obs.log    2022-12-08
./test28/weather_obs/weather_obs.log    2023-02-28
./test25/weather_obs/weather_obs.log    2022-08-18
./python/weather_obs/weather_obs.log    2021-05-24
./test24/weather_obs/weather_obs.log    2022-11-22

Here is a bsd version –   uses exec

 

[user1@freebsd12_3 ~]$ find . -name "weather_obs.log"  -exec stat -f "%N %Sm" {} +
./github/weather_obs/weather_obs.log Jan 24 10:47:34 2023
./weather_obs.log Aug 18 21:40:02 2022
./test25/weather_obs/weather_obs.log May 16 10:07:57 2023
./test27/weather_obs/weather_obs.log Jan  6 10:03:16 2023
./testbak/weather_obs/weather_obs.log Nov 18 14:32:31 2022
./testdst/weather_obs/weather_obs.log Mar 13 13:32:43 2023
./test30/weather_obs/weather_obs.log May 16 10:07:57 2023

This will work in Linux as well – but output is  a bit different.

 

user1@jon-f1-google-iowa:~$ find . -name "weather_obs.log"  -exec stat -f "%N %Sm" {} +
stat: cannot read file system information for '%N %Sm': No such file or directory
  File: "./test27/weather_obs/weather_obs.log"
    ID: 450374cda88701e7 Namelen: 255     Type: ext2/ext3
Block size: 4096       Fundamental block size: 4096
Blocks: Total: 2522434    Free: 1441271    Available: 1307742
Inodes: Total: 647168     Free: 537653
  File: "./test26/weather_obs/weather_obs.log"
    ID: 450374cda88701e7 Namelen: 255     Type: ext2/ext3
Block size: 4096       Fundamental block size: 4096
Blocks: Total: 2522434    Free: 1441271    Available: 1307742
Inodes: Total: 647168     Free: 537653
  File: "./test28/weather_obs/weather_obs.log"
    ID: 450374cda88701e7 Namelen: 255     Type: ext2/ext3
Block size: 4096       Fundamental block size: 4096
Blocks: Total: 2522434    Free: 1441271    Available: 1307742
Inodes: Total: 647168     Free: 537653
  File: "./test25/weather_obs/weather_obs.log"
    ID: 450374cda88701e7 Namelen: 255     Type: ext2/ext3
Block size: 4096       Fundamental block size: 4096
Blocks: Total: 2522434    Free: 1441271    Available: 1307742
Inodes: Total: 647168     Free: 537653
  File: "./python/weather_obs/weather_obs.log"
    ID: 450374cda88701e7 Namelen: 255     Type: ext2/ext3
Block size: 4096       Fundamental block size: 4096
Blocks: Total: 2522434    Free: 1441271    Available: 1307742
Inodes: Total: 647168     Free: 537653
  File: "./test24/weather_obs/weather_obs.log"
    ID: 450374cda88701e7 Namelen: 255     Type: ext2/ext3
Block size: 4096       Fundamental block size: 4096
Blocks: Total: 2522434    Free: 1441271    Available: 1307742
Inodes: Total: 647168     Free: 537653

 

Leave a Reply