[RESOLVED] dynamically check version of exe file in FTP - VB.Net
to find version of an exe, i use this code
Code:
Dim FileProperties As FileVersionInfo = FileVersionInfo.GetVersionInfo(Application.ExecutablePath)
Textbox1.Text = FileProperties.FileVersion
How come we find a version of an exe that's uploaded in FTP? i need the version of an exe that's already there in FTP. i know the path where the exe file is saved in FTP.
Re: dynamically check version of exe file in FTP - VB.Net
Thanks mrjohn for your reply...
so we cannot get version number of an exe from FTP.
if you include version into file name, then how come you check the exact file from .ListDirectory.
what i'm trying to do is, i need to check the version number of exe in FTP and check version number of exe in local machine. if it's different, then need to download exe from FTP.
Re: dynamically check version of exe file in FTP - VB.Net
FTP protocol provides little help for that.
In order to get the version either place it in the file name or place some other file on the ftp server. It can contain the current version in its name (the wastest way).
To update you should place the executable on the server and update the version information file.
I've used a similar approach with the only difference that I placed 'version.txt' file on the server and put the version inside. It was only after when I realized that I could get by without downloading by simply looking for a filename that fits some pre-determined pattern.
Re: dynamically check version of exe file in FTP - VB.Net
thanks cicatrix for your reply...
so in order to find the version number, i need to create 'version.txt' in FTP and put exe's version inside that. and when i want to check version number from FTP, then download version.txt file and read the version number.
Re: dynamically check version of exe file in FTP - VB.Net
Either like that, or simply put a file ver0001 on the ftp folder (version 1) then change it to ver0002 (version 2), etc.
In this case you wouldn't even have to download it - you can read version right from the file name.
Re: dynamically check version of exe file in FTP - VB.Net
Attached Class used for downloading files from FTP.
the exe name is getting too big. so instead of adding the version number in exe name, i will create a text file in that folder that contains verison number. so i can check this .txt file name to get version number.
for example: the text file name is going to be Ver.1.0.0.34.txt. 1.0.0.34 is version number, that keeps on change.
is there a way i can check the file that starts with "Ver" and ends with ".txt". so i can find the version number.
Re: dynamically check version of exe file in FTP - VB.Net
Thanks everyone for your help
in the attached file, function GetFileList there is a line
Code:
mess = m_sMes.Split(seperator)
mess is an array of string:
So if the fucntion GetFileList you are reading the file names into the array 'mess'. So you need a new function to get the version, you already have the filenames in a string array. Pass 'mess' array into a function to loop through the array and do some string compair to find the file you need.
Code:
Public Function GetVerFile(ByVal mess() As String)
Dim VerFileName As String
For Each strfile In mess
If strfile.SubString(0, 3) = "Ver" And strfile.Substring(strfile.length - 3, 3) = "txt" Then
''do some code here. If code is here then strfile must start with 'Ver' and end with 'txt'. This is persuming that the names returned in the array have the extension on the end.
End If
Next
Return VerFileName
End Function