secure copy in a shell script

Saturday, December 29, 2012 , , , 0 Comments

I have a list of file names in a file. The file names have many extensions. But I am only interested in file names which have ".txt" as their extension.

The solution is :
while read rname
do
ext=`echo $rname|awk -F"." '{print $NF}'`
if [[ "$ext" == "txt" ]]
then
scp $scp_user@$scp_server:${rname} /a/b/c/
fi
done < filenamelist.txt

0 comments: