Topic "Get Files in VB.Net"

Author Message
AvinashDesai
[View user's profile]

Joined: 2015-05-28
Posts: 12
Location: Bangalore - INDIA
I have written code which connects and get the files from it .
I want to know how to retrieve only .txt files from that folder and that too latest one .
Advertisements
AvinashDesai
[View user's profile]

Joined: 2015-05-28
Posts: 12
Location: Bangalore - INDIA
I want to know identifying the extension of the file and lastwrite time .. I used below code

InitFile = directory.Files.OrderByDescending(Function(f) f.LastWriteTime).First


To get the lastwrite time but it always returs name with "." I have txt files which I want mainly not all .. Is thr any property in the RemoteFileInfo which can help ?
AvinashDesai
[View user's profile]

Joined: 2015-05-28
Posts: 12
Location: Bangalore - INDIA
any helpers?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
I do not know VB.NET, but in C# it would be like:

RemoteFileInfo latestTextFile = dir.Files.Where(file => file.Name.EndsWith(".cpp")).OrderByDescending(file => file.LastWriteTime).First();
AvinashDesai
[View user's profile]

Joined: 2015-05-28
Posts: 12
Location: Bangalore - INDIA
Even C# also fine .. Let me look at that and check how it works..

thanks for that help once again Smile
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License