Change FTP folder in powershell

Welcome Forums General PowerShell Q&A Change FTP folder in powershell

This topic contains 1 reply, has 2 voices, and was last updated by

1 year, 8 months ago.

  • Author
  • #71200

    Points: 0
    Rank: Member

    Hi There,

    i want to use the following script to sent some txt files by powershellscript to FTP server once a week:


    #ftp server
    $ftp = ""
    $user = "username"
    $pass = "Password"

    $webclient = New-Object System.Net.WebClient

    $webclient.Credentials = New-Object System.Net.NetworkCredential($user,$pass)

    #list every sql server trace file
    foreach($item in (dir $Dir "*.txt")){
    "Uploading $item..."
    $uri = New-Object System.Uri($ftp+$item.Name)
    $webclient.UploadFile($uri, $item.FullName)

    Only we connecting to the homefolder of the ftp user. Is there a way to i can browse to antoher folder before uploading the .txt files?

    Thanks in advanced.

  • #71329

    Points: 26
    Rank: Member

    Look at using this module. I've used it at several customers and it did the job:

The topic ‘Change FTP folder in powershell’ is closed to new replies.

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