help in ksh scripting in aix

Hello gurus

I am looking for a script :

We need to generate a file list created by user id on a AIX box.

Criteria 1: other than userid : dwimpid & aiadmin
Criteria 2: Files older than 2 months ( it can be any user id ).

File Path to Look: /project and /project1

Thx
silu

Try:

find /project /project1 -mtime +60 -o -user dwimpid -o -user aiadmin
1 Like

Sorry, do you mean in criteria 1 "any ownership other than dwimpid and aiadmin" ?
If so:

find /project /project1 -mtime +60 -o \! \( -user dwimpid -o -user aiadmin \) -print
1 Like

hi

The following command when executed is not printing the files created by users .I donot want the files created by users dwimpid & aiadmin

I just need the report in the form of txt of various files created by any user except users such as dwimpid & aiadmin on /project and /project1 directories .Those files should be older than 2 months

Hope i am clear
thx!
silu

So files that are older than 2 months AND are NOT owned by dwimpid or aiadmin ?

find /project /project1 -mtime +60 -a \! -user dwimpid -a \! -user aiadmin -print

"-a" is AND, "-o" is OR, "\!" is NOT. If you use or, you have to be careful of precedence so use brackets "\(" and "\)"...

I hope this helps...

1 Like

Thankssssssssssssssssss a lot !!!!:slight_smile:

---------- Post updated at 05:11 PM ---------- Previous update was at 04:36 PM ----------

Thanks for the earliar reply ,If i executes the command given by you its showing the names of files

Is there anyoption to print the owner of the file too ?

Thx!
silu

If you have GNU "find", you can use "-ls" instead of "-print". Otherwise you could use something like:

find /project /project1 -mtime +60 -a \! -user dwimpid -a \! -user aiadmin -exec ls -ld {} \;

to view the ownership...

1 Like

Many thanks and appreciate all help !!! it worked