I am new to PowerShell and I would like to be able to upload a file into a SFTP. I manually upload this file each morning and retrieve the results later in the date. The upload file is tricky because it has a date stamp, examples file_name_20161125, file_name_20161201, file_name_20161202. Below is what I have researched online and found in order to start this project.
# Get Date in order to find out date stamp
$date = Get-Date -UFormat "%Y%m%d"
# File location and name
$locPath = "V:\Prod"
$locFileName = "file_name_"
$locExtension = ".csv"
$locUploadName = $locPath + $locFileName + $date + $locExtension
# FTP server information
$Username = "username"
$Password = "password"
$RemoteFile = "ftp://abc.dfg.com"
I am pretty new to PowerShell too, but I solved a similar task with my favorite free SFTP client WinSCP (https://winscp.net/).
They have a .NET Assembly that you can use with PowerShell. But I recently found a "WinSCP PowerShell Wrapper Module" (http://dotps1.github.io/WinSCP) that will make it even easier.