I need to transfer folders of data from our Unix environment to the network. One file transfer works great but not for folders. Newbie here.
**I got this code, looks great and simple:**
source = "c:\source"
$destination = "ftp://username:password@example.com/destination"
$webclient = New-Object -TypeName System.Net.WebClient
$files = Get-ChildItem $source
foreach ($file in $files)
{
Write-Host "Uploading $file"
$webclient.UploadFile("$destination/$file", $file.FullName)
}
$webclient.Dispose()
My interpretation, not so good:
$destination = "\\fmh-utilzz\c$\visbkups\"
$sourceftp = "ftp://userid:password@fxxxxx.com/users/gmj0687/ftptest/"
"ftp url: $sourceftp"
$webclient = New-Object System.Net.WebClient
$Sourceuri = New-Object System.Uri($sourceftp)
$files = Get-ChildItem $destination
#
foreach ($file in $files)
{
Write-Host "Downloading $file"
$webclient.DownloadFile("$destination/$sourceuri", $file.FullName)
}
$webclient.Dispose()
Any help would be great.