I have a list of filenames without file extensions. I want to loop that list and search for every file-prefix and if a file was found then copy it to a location.
Right now my script produces *2209589
from string 32201069
.
But instead 32201069
should become 32201069*
to the -name
parameter of find
!
My problem is, I cant append an *
asterisk to my names from the file, as "{$filename}*
seems to override the first character of the filename string instead of appending it.
while read filename; do
find . -name "${filename}*" -print \
-exec cp -n {} /Users/herrsch/Desktop/foundimages \;;
done < /Users/herrsch/Desktop/fileprefixes.txt