We are using HP-UX. Previously we were using ftp to connect to remote list the text file name and copy into local file with .ls extension. For this we are using
nlist RBOBAR*.txt DMSFT.ls
now we want to convert the integration with sftp. So In sftp nlist command is not supported. How can we write a script to copy the remote file name lists to local directory into the file in sftp. Can anyone help me to solve the concern . Thanking you advance.
sftp me@anothercomputer <<! > listoffilenames.txt
cd /path/to/files
ls RBOBAR*.txt DMSFT.ls
!
# want to see what you got? add this line
cat listoffilenames.txt
Please find the below code of ftp of files from server to client
if [ $1 -eq 2 -o $1 -eq 1 ]
then
#{
mkdir $HOME/ACUPLD_IN
cd $HOME/ACUPLD_IN
dt=`date +%d%m`
tm=`date +%H%M%S`
ftp -n dms_ip <<SS
user `crypt 123 <$TBA_PROD_ROOT/cust/com/cbstodms.user` `crypt 123 <$TBA_PROD_ROOT/cust/com/cbstodms.pw`
prompt
cd ao_custopn_in
!touch DMSFT_ACUPLD"_$dt"_$tm.lst
!chmod 0775 DMSFT_ACUPLD"_$dt"_$tm.lst
nlist *"$2"*"ACC"*txt DMSFT_ACUPLD"_$dt"_$tm.lst
bye
SS
for v2 in `cat DMSFT_ACUPLD"_$dt"_$tm.lst | awk '{print $1}'`
do
#{
p1=`echo $v2|cut -d '_' -f2`
p2=`echo $v2|cut -d '.' -f3`
p3=`echo $v2|cut -d '_' -f3`
if [ "$p3" = "ACC" ]
then
if [ "$p1" = "$2" ]
then
if test -z "$p2"
then
echo $v2 >> DMSFT_ACUPLD"_$dt"_$tm.txt
echo '\n' >> DMSFT_ACUPLD"_$dt"_$tm.txt
fi
fi
fi
#}
done
sed '/^$/d' DMSFT_ACUPLD"_$dt"_$tm.txt > DMSFT_ACUPLD"_$dt"_$tm.TXT
rm -rf DMSFT_ACUPLD"_$dt"_$tm.lst
rm -rf DMSFT_ACUPLD"_$dt"_$tm.txt
v=0
v=`cat DMSFT_ACUPLD"_$dt"_$tm.TXT | wc -l`
while [ "$v" -ne 0 ]
do
#{
if [ $v -eq 0 ]
then
break
fi
for v2 in `cat DMSFT_ACUPLD"_$dt"_$tm.TXT | awk '{print $1}'`
do
#{
cd $HOME/ACUPLD_IN
ftp -n dms_ip <<SS
user `crypt 123 <$TBA_PROD_ROOT/cust/com/cbstodms.user` `crypt 123 <$TBA_PROD_ROOT/cust/com/cbstodms.pw`
prompt
cd ao_custopn_in
mget $v2
rename $v2 $v2.done
bye
SS
v=`expr $v - 1`
#}
done
#}
done
#}
fi
The above code needs to be changed to sftp . Can any one help to make out the above code to sftp .
Thanks and Regards,
Pelins
8767541659
---------- Post updated at 05:08 PM ---------- Previous update was at 04:54 PM ----------
Sftp(openssh7.5) is in passwordless authentication between windows server 2012 and unix as client. I too want to know whether home directory of OpenSSH7.5 can be changed from installed path to another drive in windows server 2012. Kindly guide.
We need a better description of the problem than "reverse engineer this ancient, convoluted, 1000 line shell script and do the exact same thing with an incompatible tool".