Find files younger than a file and print them without their paths

34 Views Asked by At

I am on AIX and I am trying to create a shell that checks all files inside a directory that are created/modified after a particular file and print the result on a txt file without paths, I just need their names.

I am trying:

find /sas/data/p1/s5/*spds9 -newer /sas_copiadati/aut_eq_*.cpo >>/sas_copiadati/aut_eq.txt

but this way I get their paths, and I don't want them, I just need file names.

I tried -printf option but it gives me "-printf is not a valid option"

Any help? thanks!

1

There are 1 best solutions below

0
Romeo Ninov On

What you can try is to use command like:

find /sas/data/p1/s5/*spds9 -newer /sas_copiadati/aut_eq_*.cpo -exec basename {} \;

basename will strip the path and print only filemane.