From 7812582cfed827610f09ed78675c4e44415ee518 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Sun, 6 May 2012 22:20:26 -0400 Subject: [PATCH] new simple script, locates a filename passed to it in a directory hierarchy. --- scripts/files/find_same_filename.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 scripts/files/find_same_filename.sh 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" + + -- 2.34.1