[CS-FSLUG] find and .gvfs

sjm sjm.mlists at gmail.com
Sat Jul 9 22:33:24 CDT 2011


On 07/09/2011 05:17 PM, Mark Clayton wrote:
> I'm trying to write a bash script to find all files that are not being owned
> by a user or group:
> find / -path '.gvfs' -prune -o -path '/proc' -prune -o -nouser -o -nogroup
> -print
> if [ $? -eq 0 ]
> then
> exit $STATE_OK
> else
> echo "Files with no owner or group found"
> exit $STATE_CRITICAL
> fi
>
> The script basically works except it stumbles on a directory created by the
> gnome virtual filesystem daemon called .gvfs. The results are:
> find: `/home/mark/.gvfs': Permission denied

If I read the man page correctly, the -path starts relative to the find 
start point, so your '.gvfs' with the start point of "/" is probably 
looking to prune "/.gvfs" rather than each .gvfs under each home directory.

You might try adding in the correct paths relative to the start point or 
you might try a "-not .gvfs" type expression.

sjm




More information about the Christiansource mailing list