FTP Details
Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
6 posts
Page 1 of 1
I'll teach you how to list folders with some multiple info, like file date/size/permissions on ftp (read/write).
Add listview to your form and set it's view to details.
Add 4 columns - "File Name", "Size", "Date" and "Permissions" it is column title.
Now add GET button or refresh, name it whatever you want, and add this code.
*************************** EDIT ***************************
So, I've decided to upload the whole project, with 'back' function, and navigation through the folders. Ability to download/upload files, and make new folder.
Add listview to your form and set it's view to details.
Add 4 columns - "File Name", "Size", "Date" and "Permissions" it is column title.
Now add GET button or refresh, name it whatever you want, and add this code.
Code: Select all
I hope you like it, i added info about functions inside the code.
Dim ftpClient As System.Net.FtpWebRequest = CType(Net.WebRequest.Create("ftp://HOST/Folder"), Net.FtpWebRequest)'Must include ftp:// in front
ListView1.Items.Clear()
ftpClient.Method = Net.WebRequestMethods.Ftp.ListDirectoryDetails
ftpClient.Credentials = New Net.NetworkCredential("username", "password")
Dim ftpClientResponse As Net.FtpWebResponse = CType(ftpClient.GetResponse(), Net.FtpWebResponse)
Dim ftpStream As IO.Stream = ftpClientResponse.GetResponseStream()
Dim ftpStreamReader As New IO.StreamReader(ftpStream)
For Each iFile As String In ftpStreamReader.ReadToEnd.Split(vbCrLf)
If iFile <> "" Then
While iFile.Contains(" ")
iFile = iFile.Replace(" ", " ") 'It is some crazy format, so i do this to reformat it so i can split that string
End While
Dim lvi As New ListViewItem
Dim fileString() = iFile.Split(" ")'Splitting and getting Collection
For i As Integer = 8 To fileString.Length - 1
lvi.Text += fileString(i) + " " 'Name - (+ " ") returns the space that was used to split string
Next
lvi.Text = lvi.Text.Substring(0, lvi.Text.Length - 1)'Removes space at the end of list view item's text.
'It should be just 8, but if your file/folder has spaces in it it will get first word only.
lvi.SubItems.Add(fileString(4)) 'Size
lvi.SubItems.Add(fileString(5) + "-" + fileString(6) + "-" + fileString(7)) 'Date
lvi.SubItems.Add(fileString(0)) 'Permissions
ListView1.Items.Add(lvi)
End If
Next
Catch ex As Exception
End Try
*************************** EDIT ***************************
So, I've decided to upload the whole project, with 'back' function, and navigation through the folders. Ability to download/upload files, and make new folder.
You do not have the required permissions to view the files attached to this post.
Update, now can make difference between files and folders. Those that downloaded - pm me you'll get source for free.
You do not have the required permissions to view the files attached to this post.
using FtpWebRequest is very easy to access a ftp server but you need to login every time you do an operation like renaming, uploading, folder/file creation, deletion etc.
You can find me on Facebook or on Skype mihai_92b
i'm making a ftp client but i cant find a way to delete a folder and all the other folders and sub-folders within it
You can find me on Facebook or on Skype mihai_92b
XTechVB wrote:i'm making a ftp client but i cant find a way to delete a folder and all the other folders and sub-folders within ithttp://stackoverflow.com/questions/4866 ... les-within
We shall let the revolution begin.. the revolution for freedom, freedom against censorship. We shall fight in the fields and in the streets, we shall fight in the hills; we shall never surrender
Codex wrote:thats for the FtpWebRequest class! i'm using socketsXTechVB wrote:i'm making a ftp client but i cant find a way to delete a folder and all the other folders and sub-folders within ithttp://stackoverflow.com/questions/4866 ... les-within
You can find me on Facebook or on Skype mihai_92b
6 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023