From: Chris Koeritz Date: Mon, 7 May 2012 02:20:26 +0000 (-0400) Subject: new simple script, locates a filename passed to it in a directory hierarchy. X-Git-Tag: 2.140.90~1355 X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;h=7812582cfed827610f09ed78675c4e44415ee518;p=feisty_meow.git new simple script, locates a filename passed to it in a directory hierarchy. --- diff --git a/scripts/files/find_same_filename.sh b/scripts/files/find_same_filename.sh new file mode 100644 index 00000000..a407e7b5 --- /dev/null +++ b/scripts/files/find_same_filename.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# finds the same file name within a hierarchy, if possible. + +name="$1"; shift +search_dir="$1"; shift + +if [ -z "$name" -o -z "$search_dir" ]; then + echo This script needs two parameters, the filename to look for and the + echo directory hierarchy to look for it in. + exit 1 +fi + +# just get the filename or directory name component at the end. +name="$(basename "$name")" + +find "$search_dir" -iname "$name" + +