find in current directory Only


find commands on the current directory on Solaris, without going into sub directories.

Solution:

Add the following operations with find commands :

! \( -type d ! -name {DIRECTORY NAME} -prune \)

Replace the directory to be searched for {DIRECTORY NAME}

Example:

Below example will only remove all files from current directory older than one week.

find . ! \( -type d ! -name . -prune \) -mtime 7 -exec rm {} \;

No comments:

Post a Comment