Executing SFTP transfers in BASH scripts | linux centos ssh rcp sftp ftp bash script batch file automation

I need to write a script which fetched files off a ftp server and put it into a specify folder for processing.

I was used to using SSH for these job and now I was forced to connect to an SFTP server, this was my first time and everything is a little different.

I have attached the commands I used in my bash script to get the project over the line.


This command allows you get a listing of what is currently on the server.

This will fetch all the CSV files on the SFTP server and copy them locally.

This was partially tricky, don’t know why. They may be an easier way which I overlooked but this worked for me. For some reason to send file you need to specify the instructions in a batch file which is execute once connected.


Leave a Reply

Your email address will not be published. Required fields are marked *