bash script using scp (pw typed by hand) followed by removal of files

Hello,

I tried to write a bash script (code is below) that does scp files that contain a certain string, and that subsequently deletes only those files that have been copied (in my case new files are created every second so it is important to only delete those that have been copied). The key is that I do want to type in the pw for the scp by hand and only once because there are so many files.

Can someone please have a look at the code below including the comments I made and give me some advise? Many thanks.

#!/bin/bash
echo -e "enter filename string: \c "
read  word
echo "entered string: $word"

#here I need a list or something that holds the files that are available before the scp starts

#currently, this will only hold one file
for i in $(ls -t $word*.txt); do echo "scp $i" ; done

#below scp files based on string provided; important I want to type the pw by hand
scp $word*.txt DIR

#now rm only those files that have been copied
#more files will be created every second so it is important to only delete those that have been copied

#because i holds only one file, it only deletes that one, which is not what I want
echo "deleting $i" 
rm "$i"

---------- Post updated at 05:46 AM ---------- Previous update was at 04:10 AM ----------

I found it out myself:

files=$(find $word*.jpg)

scp -p $word*.jpg $login

for k in "$FILES"; do rm $k; done