X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=scripts%2Ffiles%2Ffind_same_filename.sh;fp=scripts%2Ffiles%2Ffind_same_filename.sh;h=a407e7b5d3fff19666b5fbebd55ab15f71dc7349;hb=7812582cfed827610f09ed78675c4e44415ee518;hp=0000000000000000000000000000000000000000;hpb=081adcd730590ccefdad74eac4f3334960bf6ee2;p=feisty_meow.git 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" + +