I have provided my own answer below.
We have a number of bash scripts that work fine using SFTP, what I would like to do is to simply re-direct an ls or dir of a folder to a file on our SFTP Server..
We can run this as a cron job or I can run it manually.. I can view the list of files from the remote server, but I want to generate the list of files from the remote server to the local server in a text file..
Here is what I have for the bash script so far.. The fourth echo listed below is the line in question.
#!/bin/bash localpath=/home/localacct/somepath remotelocation=/home/account/logs/archive remotehost=' firstname.lastname@example.org' echo > $localpath/list.sftp echo "cd $remotelocation " >> $localpath/list.sftp echo "dir *.* " >> $localpath/list.sftp echo "dir *.* > $localpath/dirlist.txt " >> $localpath/list.sftp echo "bye " >> $localpath/list.sftp sftp -b $localpath/list.sftp $remotehost exit