Author Posts

April 22, 2016 at 6:36 pm

I have a script I wrote to transfer files from a Windows 10 tablet to a remote for server working as intended. New wrinkle is that the user wants the ability to either select an existing directory on the remote server or enter the name of a new directory to be created. I'm really stuck. Can anyone point me in the right direction? My Google foo is failing me.


April 22, 2016 at 6:59 pm

Are you sure you're using ftp and not smb/cifs? What is your current script?

April 23, 2016 at 3:45 am

Yep, positive it's FTP:

#Specify the directory where all files that we want to upload
$source="C:\Users\$Env:username\Pictures\Camera Roll\"
$destination = "ftp://phototransfer@"

$webclient = New-Object System.Net.WebClient

$files = Get-ChildItem $source

foreach ($file in $files)
Write-Host "Uploading $file..."
$webclient.UploadFile("$destination/$file", $file.FullName)
Remove-Item $source/$file