Am trying to copy a file from HP-UX to my Windows machine using PowerShell script.
Please find my script below.
$File = "d:\copiedfile.txt"
$ftp = "ftp://my_Unix_Domain_name/tmp/sourceFile.txt"
"ftp url: $ftp"
$webclient = New-Object System.Net.WebClient
$uri = New-Object System.Uri($ftp)
"Downloading $File..."
$webclient.DownloadFile($uri, $File)
Am able to connected via FTP but, files not copied to my destination directory.
I'm getting an error:
The remote server return ed an error: (550) File unavailable (e.g., file not found, no access).
Not sure, what is wrong in it.
I'm able to download the file using command-line ftp
:
ftp> get /tmp/text.sh
200 PORT command successful.
150 Opening ASCII mode data connection for /tmp/test.sh (71 bytes).
226 Transfer complete.
ftp: 76 bytes received in 0.00Seconds 76000.00Kbytes/sec.
ftp>
Exception calling "DownloadFile" with "2" argument(s): "The remote server return ed an error: (550) File unavailable (e.g., file not found, no acces)."
. But when am trying to get this file manually usingftp
am able to get this file from remote location without any issues. – Karthikeyanftp
! + Add the information (including the error message) to your question. Do not post important information in comments. – Martin Prikrylftp
, it displays some output. We want to see that. – Martin Prikrylget tmp/test.sh
(without leading slash) do? – Martin Prikryl