diff options
| author | Ian C <ianc@noddybox.co.uk> | 2026-06-24 20:39:09 +0100 |
|---|---|---|
| committer | Ian C <ianc@noddybox.co.uk> | 2026-06-24 20:39:09 +0100 |
| commit | 38dbffd816a23d5aab1df74a37da48701f831321 (patch) | |
| tree | 2126296a6e8a5b26f709c34410779eddade621b9 | |
| parent | d1b1d274216b5c3e0011544f3c74a23744776f87 (diff) | |
| -rwxr-xr-x | cpflat.sh | 40 | ||||
| -rwxr-xr-x | lcase.sh | 6 | ||||
| -rwxr-xr-x | ucase.sh | 6 |
3 files changed, 51 insertions, 1 deletions
diff --git a/cpflat.sh b/cpflat.sh new file mode 100755 index 0000000..0092ea4 --- /dev/null +++ b/cpflat.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +IFS=' +' +_=$(basename $0) + +if [ "x$1" == "x-r" ] ; then + RENAME=y + shift +fi + +if [ -z "$2" ] ; then + echo $_: usage $_ [-r] scp_destination extension + exit 1 +fi + +DEST=$1 +EXT=$2 + +flist=$(find . -type f -iname "*.$EXT") + +for i in $flist ; do + dir=$(dirname "$i") + last_dir=$(basename "$dir") + + if [ -z "$last_dir" ] ; then + last_dir=$dir + fi + + fname=$(basename "$i") + + if [ "$RENAME" ] ; then + fname="$last_dir.$EXT" + fi + + if ! scp "$i" "$DEST/$fname" ; then + echo $_: Copy failed + exit 1 + fi +done @@ -3,7 +3,11 @@ IFS=' ' -flist=$(find . -type f) +if [ "$1" ] ; then + flist=$(find . -type f -iname "*.$1") +else + flist=$(find . -type f) +fi for i in $flist ; do fname=$(basename $i) @@ -3,6 +3,12 @@ IFS=' ' +if [ "$1" ] ; then + flist=$(find . -type f -iname "*.$1") +else + flist=$(find . -type f) +fi + flist=$(find . -type f) for i in $flist ; do |
