Upload file with date stamp to SFTP

Welcome Forums General PowerShell Q&A Upload file with date stamp to SFTP

This topic contains 2 replies, has 3 voices, and was last updated by

2 years, 3 months ago.

  • Author
  • #59286

    Points: 0
    Rank: Member

    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"

    Thank you so much!

  • #59289

    Points: 58
    Rank: Member
  • #59314

    Points: 0
    Rank: Member

    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.

The topic ‘Upload file with date stamp to SFTP’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort