Answer the question
In order to leave comments, you need to log in
Why does ReadToEnd() throw an error (PowerShell)?
There is a simple PowerShell script that should give a list of files in an ftp directory.
$Username = "111"
$Password = "111"
$folderPath="ftp://10.10.10.10/test/"
$credentials=New-Object System.Net.NetworkCredential($Username,$Password)
$request = [System.Net.WebRequest]::Create($folderPath)
$request.Method = [System.Net.WebRequestMethods+FTP]::ListDirectoryDetails
$request.Credentials = $credentials
$response = $request.GetResponse()
$stream = $response.getresponsestream()
$reader = New-Object IO.StreamReader $response.GetResponseStream()
$files = $reader.ReadToEnd()
print $files
$reader.Close()
$response.Close()
Недопустимый ключ - ""-rw-rw-r-- 1 512 100 172494727 Aug 22 2015 1.psd
-rw-rw-r-- 1 512 100 29271702 May 26 2015 1220TЕ1024_5.psd
drwxrwxr-x 16 506 100 4096 Dec 09 13:49 111
-rw-rw-r-- 1 512 100 139776 Jul 22 2014 2222.xls
...
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question