find command help

Ibm Per processor d5 aix 5l v5.3
May 4, 2010 at 12:46:39
Specs: IBM AIX 5.3, 4GB RAM
Hi,

I need a help with find command. I would like to execute a find command on one of the file system and would like to skip certain files from the find command. I need the reverse also.

Step 1: For ex, I am going to execute the below find command under /data/a directory.

find /data/a -type f -name "*" -print.

In this find, I would like to skip the following files
/data/a/ar/actfil.dbd, /data/a/ar/actkey.dbk, /data/a/oe/sysfil.dbd, /data/a/oe/syskey.dbk.

In Step 2, I would like to run the same command, but this time it should only the fetch the files that were not fetched in step 1 (/data/a/ar/actfil.dbd, /data/a/ar/actkey.dbk, /data/a/oe/sysfil.dbd, /data/a/oe/syskey.dbk).

Is there a way to achieve this? Please help.

Thanks,
Balaji.


See More: find command help

Report •

#1
May 4, 2010 at 13:01:23
Hi,

An update. The skip list does not contain exactly four files. It can be anywhere from 30 to 40 files. The entire directory structure of /data/a contains more than 3000 files. Can I enter the skip list in an input file and use it with the find command?

Thanks,
Balaji.


Report •

#2
May 5, 2010 at 06:35:50
find . -type f | grep -i -v "/data/a/ar/actfil\.dbd\|/data/a/ar/actkey\.dbk\|/data/a/oe/sysfil\.dbd\|/data/a/oe/syskey\.dbk"

gets the excluded names, then remove the -v option to get only the names
alternatively, put the names into a textfile (f/e: ffi), and:
find . -type | grep -i -f ffi

ffi contents:
/data/a/ar/actfil\.dbd
/data/a/ar/actkey\.dbk
/data/a/oe/sysfil\.dbd
/data/a/oe/syskey\.dbk

note in both cases i believe the dot has to be escaped with \


Report •
Related Solutions


Ask Question