| | |
FTP Server Directory Treeview
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
Just because there is no help for this online that i could find, I'm posting this for all the other coders...
This makes use of a third part class downloaded from code project... AWESOME FTP class this , i owe the creators a huge thank you ...
Happy coding people , code is shibby ....
This makes use of a third part class downloaded from code project... AWESOME FTP class this , i owe the creators a huge thank you ...
C# Syntax (Toggle Plain Text)
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Data.Sql; using System.Data.SqlClient; using System.Data.OleDb; using System.Windows.Forms; using System.IO; using System.Net.Mail; using System.Net; using System.Net.Mime; using System.Web; using System.IO.Compression; using Microsoft.Win32; using System.Net.Sockets; using System.Runtime; namespace TestDummyTWO { public partial class Form1 : Form { FTPLib.FTP FTPLIB = new FTPLib.FTP(); public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { /* THIS IS THE FORMULA * TreeNode MyNodeMain = new TreeNode(); * TreeNode MyNodeChild = new TreeNode(); * MyNodeMain.Text = "Main"; * MyNodeChild.Text = "child"; * mytree.Nodes.Add(MyNodeMain); * MyNodeMain.Nodes.Add(MyNodeChild); */ FTPLIB.server = "******"; FTPLIB.user = "*******"; FTPLIB.pass = "******"; foreach (string S in FTPLIB.ListDirectories()) { /* Making parent node */ TreeNode ParentNode = new TreeNode(); ParentNode.Text = S.Substring(55); treeView1.Nodes.Add(ParentNode); /* Making child node */ FTPLIB.ChangeDir("//" + S.Substring(55) + "/"); foreach (string S2 in FTPLIB.List()) { FTPLIB.ChangeDir("//" + S.Substring(55) + "/"); TreeNode ChildNode = new TreeNode(); ChildNode.Text = S2.Substring(55); ParentNode.Nodes.Add(ChildNode); FTPLIB.ChangeDir("."); } } } } }
Happy coding people , code is shibby ....
Last edited by cVz; Jan 9th, 2009 at 9:38 am.
Delphi & C# programmer deluxe...
•
•
Join Date: Aug 2008
Posts: 1,735
Reputation:
Solved Threads: 186
lets pray the ftp servers you use always return exactly the same format in each line then, and that they dont have longer filenames, or usernames or longer/shorter permissions.
However, builing a tree view of something is generally an easy enough concept, and your treeview only allows 1 level, its not recursive.. but, its good you got there in the end.
Btw, shouldnt
be a little pointless as you are changing to a fully qualified path each time. and "." means dont change.
However, builing a tree view of something is generally an easy enough concept, and your treeview only allows 1 level, its not recursive.. but, its good you got there in the end.
Btw, shouldnt
C# Syntax (Toggle Plain Text)
FTPLIB.ChangeDir(".");
Did I just hear "You gotta help us, Doc. We've tried nothin' and we're all out of ideas" ? Is this you? Dont let this be you! I will put in as much effort as you seem to.
•
•
•
•
FTPLIB.ChangeDir(".");
Its the theory you see there, i just gave an example , one can use this in small applications ... (i hate the treeview though, might do it with a listview....) but we already played with that hehehe
Thanks for all your help man , I'm finally finding some structure in my application to work with ...
Delphi & C# programmer deluxe...
I guess you could just use
or something, on my server the previous folder is the "."-dir so going there takes you back back back ... cool navigation i tell you ...
C# Syntax (Toggle Plain Text)
FTPLIB.ChangeDir("//");
Last edited by cVz; Jan 9th, 2009 at 10:32 am.
Delphi & C# programmer deluxe...
•
•
Join Date: Nov 2009
Posts: 1
Reputation:
Solved Threads: 0
0
#6 3 Days Ago
I am using print directory on My Computer or Windows Explorer, To print information about all your files. Print Directory can print the name of every file on a drive, along with the file's size, date and time of last modification, and attributes (Read-Only, Hidden, System and Archive)! And now, the list of files can be sorted by name, size, date.
Download Free : http://www.print-directory.com
Download Free : http://www.print-directory.com
![]() |
Similar Threads
- Help with automatic update problem and more (Viruses, Spyware and other Nasties)
Other Threads in the C# Forum
- Previous Thread: Can you help with c# again.
- Next Thread: Image distorted
| Thread Tools | Search this Thread |
.net access algorithm angle array asp.net barchart bitmap box broadcast c# capturing check checkbox client combobox control conversion csharp custom database datagrid datagridview dataset datetime dbconnection degrees delegate design development disappear draganddrop drawing encryption enum eventhandlers excel file firefox form format forms function gdi+ image index input install java label leak libraries list listbox loop mandelbrot math monodevelop mouseclick msword mysql operator path pause photoshop picturebox pixelinversion post programming radians regex remoting resourcefile richtextbox round server sleep socket sql statistics stream string table tcpclientchannel text textbox thread time timer update usercontrol validation virtualization visualbasic visualstudio webbrowser windows winforms wpf xml






