diff --git a/copy-files.sh b/copy-files.sh index 53e8d51..ec14587 100644 --- a/copy-files.sh +++ b/copy-files.sh @@ -1,8 +1,8 @@ #!/bin/sh usage() { - echo "Usage: copy-files.sh " - echo ": file that contains the files to copy, each on a different line" + echo "Usage: copy-files.sh " + echo ": directory where the files are located" echo ": directory where the files are copied to" exit 1 } @@ -11,9 +11,7 @@ if [ $# != 2 ]; then usage fi -filename=$1 +input=$1 output=$2 -while read -r p; do - cp "$p" "$output" -done <"$filename" +find "$input" -type f -iregex '.*\.\(pdf\|doc\|docx\|xlsx\|accdb|\mdb\)' -print0 | xargs -0 cp "{}" "$output"