M Akin
M Akin

Reputation: 507

Getting Date from a file on a remote FTP Server

To get a file, the Method looks like this:

$ftprequest.Method = [System.Net.WebRequestMethods+Ftp]::DownloadFile  

So, I am trying to change the Method to be equivalent to the C# code below:

request.Method = System.Net.WebRequestMethods.Ftp.GetDateTimestamp;

How can I use GetDateTimestamp in powershell?

I have tried the following variations without any luck yet:

$ftprequest.Method = [System.Net.WebRequestMethods+Ftp.GetDateTimestamp]
$ftprequest.Method = [System.Net.WebRequestMethods+Ftp+GetDateTimestamp]
$ftprequest.Method = [System.Net.WebRequestMethods.Ftp.GetDateTimestamp]
$ftprequest.Method = [System.Net.WebRequestMethods.Ftp+GetDateTimestamp]

bonus question: what is the :: mean on the first code example mean?

Thanks!

Upvotes: 2

Views: 1635

Answers (1)

Victor Zakharov
Victor Zakharov

Reputation: 26424

This seems to work:

$ftprequest.Method = [System.Net.WebRequestMethods+Ftp]::GetDateTimestamp

:: is to access shared/static members, which GetDateTimeStamp is.

Upvotes: 1

Related Questions