#!/bin/bash
#                 /usr/local/bin/pfind
# http://crystalfaeries.net/posix/bin/pfind
# celeste:crystalfaery 2015-09-09 12:41:26+00:00

# "P Find" is a shortcut to CLI find requests to stay "local" and not wander off into:
# system special directories:
#	/lost+found			# we usually don't have access unless superuser
#	/root				# we usually don't have access unless superuser
#	/dev				# we don't really want to probe device files
#	/proc				# we don't really want to probe the kernel
#	/sys				# we don't really want to probe the kernel
#	/run				# we don't really want to probe process locks
#	/rescue				# we don't need to see the backup copy of /boot
# backups:
#	/home/rsnapshot			# rsnapshot backups
#	/var/cache/rsnapshot		# rsnapshot backups
# or NAS: (sshfs or cifs mounts of Network Attached Storage):
#	/home/dar			# LAN-shared public
#	/home/dar-			# LAN-shared public backup
#	/home/downloads			# LAN-shared public
#	/home/downloads-		# LAN-shared public backup
#	/home/public			# LAN-shared public
#	/home/public-			# LAN-shared public backup

#	NOTE:		We are only allowing one starting directory	####### Incompatible #######

#	NOTE:		-prune won't work if you append a trailing "/" to directory name	####### Wrapper Filter Needed #######
searchdir="$1"; shift	# separate out the first argument as the directory to search	####### ASSumption #######
find "$searchdir"			    \( \( \
-path /dev				-prune -o \
-path /lost+found			-prune -o \
-path /proc				-prune -o \
-path /rescue				-prune -o \
-path /root				-prune -o \
-path /run				-prune -o \
-path /sys				-prune -o \
-path /var/cache			-prune -o \
-path /var/run				-prune -o \
-path /home/dar-			-prune -o \
-path /home/dar				-prune -o \
-path /home/downloads-			-prune -o \
-path /home/downloads			-prune -o \
-path /home/public-			-prune -o \
-path /home/public			-prune -o \
-path /home/rsnapshot			-prune \) \
-fprint /tmp/find.prune.txt \) -o \
\( -iname '*[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]-[0-9a-f][0-9a-f][0-9a-f][0-9a-f]-[0-9a-f][0-9a-f][0-9a-f][0-9a-f]-[0-9a-f][0-9a-f][0-9a-f][0-9a-f]-[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f].*' \)


syntax highlighted by Code2HTML, v. 0.9.1