How can i get also the files in the root directory and how can i for testing add items of IEnumerable FTPListDetail to List string ?

What i get is only the directories and files that in other nodes. But i have also files on the root directory and i never
get them. This is a screenshot of my program after i got the content of my ftp. I'm using treeView to display my ftp content:
You can see two directories from the root but no files on the root it self. And in my ftp server host i have files in the root direcory.
This is the method i'm using to get the directory listing:
public IEnumerable<FTPListDetail> GetDirectoryListing(string rootUri)
var CurrentRemoteDirectory = rootUri;
var result = new StringBuilder();
var request = GetWebRequest(WebRequestMethods.Ftp.ListDirectoryDetails, CurrentRemoteDirectory);
using (var response = request.GetResponse())
using (var reader = new StreamReader(response.GetResponseStream()))
string line = reader.ReadLine();
while (line != null)
result.Append(line);
result.Append("\n");
line = reader.ReadLine();
if (string.IsNullOrEmpty(result.ToString()))
return new List<FTPListDetail>();
result.Remove(result.ToString().LastIndexOf("\n"), 1);
var results = result.ToString().Split('\n');
string regex =
@"^" + //# Start of line
@"(?<dir>[\-ld])" + //# File size
@"(?<permission>[\-rwx]{9})" + //# Whitespace \n
@"\s+" + //# Whitespace \n
@"(?<filecode>\d+)" +
@"\s+" + //# Whitespace \n
@"(?<owner>\w+)" +
@"\s+" + //# Whitespace \n
@"(?<group>\w+)" +
@"\s+" + //# Whitespace \n
@"(?<size>\d+)" +
@"\s+" + //# Whitespace \n
@"(?<month>\w{3})" + //# Month (3 letters) \n
@"\s+" + //# Whitespace \n
@"(?<day>\d{1,2})" + //# Day (1 or 2 digits) \n
@"\s+" + //# Whitespace \n
@"(?<timeyear>[\d:]{4,5})" + //# Time or year \n
@"\s+" + //# Whitespace \n
@"(?<filename>(.*))" + //# Filename \n
@"$"; //# End of line
var myresult = new List<FTPListDetail>();
foreach (var parsed in results)
var split = new Regex(regex)
.Match(parsed);
var dir = split.Groups["dir"].ToString();
var permission = split.Groups["permission"].ToString();
var filecode = split.Groups["filecode"].ToString();
var owner = split.Groups["owner"].ToString();
var group = split.Groups["group"].ToString();
var filename = split.Groups["filename"].ToString();
var size = split.Groups["size"].Length;
myresult.Add(new FTPListDetail()
Dir = dir,
Filecode = filecode,
Group = group,
FullPath = CurrentRemoteDirectory + "/" + filename,
Name = filename,
Owner = owner,
Permission = permission,
return myresult;
And then this method to loop over and listing :
private int total_dirs;
private int searched_until_now_dirs;
private int max_percentage;
private TreeNode directories_real_time;
private string SummaryText;
private TreeNode CreateDirectoryNode(string path, string name , int recursive_levl )
var directoryNode = new TreeNode(name);
var directoryListing = GetDirectoryListing(path);
var directories = directoryListing.Where(d => d.IsDirectory);
var files = directoryListing.Where(d => !d.IsDirectory);
total_dirs += directories.Count<FTPListDetail>();
searched_until_now_dirs++;
int percentage = 0;
foreach (var dir in directories)
directoryNode.Nodes.Add(CreateDirectoryNode(dir.FullPath, dir.Name, recursive_levl+1));
if (recursive_levl == 1)
TreeNode temp_tn = (TreeNode)directoryNode.Clone();
this.BeginInvoke(new MethodInvoker( delegate
UpdateList(temp_tn);
percentage = (searched_until_now_dirs * 100) / total_dirs;
if (percentage > max_percentage)
SummaryText = String.Format("Searched dirs {0} / Total dirs {1}", searched_until_now_dirs, total_dirs);
max_percentage = percentage;
backgroundWorker1.ReportProgress(percentage, SummaryText);
percentage = (searched_until_now_dirs * 100) / total_dirs;
if (percentage > max_percentage)
SummaryText = String.Format("Searched dirs {0} / Total dirs {1}", searched_until_now_dirs, total_dirs);
max_percentage = percentage;
backgroundWorker1.ReportProgress(percentage, SummaryText);
foreach (var file in files)
TreeNode file_tree_node = new TreeNode(file.Name);
file_tree_node.Tag = "file" ;
directoryNode.Nodes.Add(file_tree_node);
numberOfFiles.Add(file.FullPath);
return directoryNode;
Then updating the treeView:
DateTime last_update;
private void UpdateList(TreeNode tn_rt)
TimeSpan ts = DateTime.Now - last_update;
if (ts.TotalMilliseconds > 200)
last_update = DateTime.Now;
treeViewMS1.BeginUpdate();
treeViewMS1.Nodes.Clear();
treeViewMS1.Nodes.Add(tn_rt);
ExpandToLevel(treeViewMS1.Nodes, 1);
treeViewMS1.EndUpdate();
And inside a backgroundworker do work how i'm using it:
var root = Convert.ToString(e.Argument);
var dirNode = CreateDirectoryNode(root, "root", 1);
e.Result = dirNode;
And last the FTPListDetail class:
public class FTPListDetail
public bool IsDirectory
get
return !string.IsNullOrWhiteSpace(Dir) && Dir.ToLower().Equals("d");
internal string Dir { get; set; }
public string Permission { get; set; }
public string Filecode { get; set; }
public string Owner { get; set; }
public string Group { get; set; }
public string Name { get; set; }
public string FullPath { get; set; }
Now the main problem is that when i list the files and directories and display them in the treeView it dosen't get/display
the files in the root directory. Only in the sub nodes.
I will see the files inside hello and stats but i need also to see the files in the root directory.
1. How can i get and list/display the files of the root directory ?
2. For the test i tried to add to a List<string> the items in var files to see if i get the root files at all.
   This is what i tried in the CreateDirectoryNode before it i added:
private List<string> testfiles = new List<string>();
Then after var files i did:
testfiles.Add(files.ToList()
But this is wrong. I just wanted to see in testfiles what items i'm getting in var files in the end of the process.
Both var files and directoryListing are IEnumerable<FTPListDetail> type.
The most important is to make the number 1 i mentioned and then to do number 2.

Risa no.
What i mean is this. This is a screenshot of my ftp server at my host(ipage.com).
Now this is a screenshot of my program and you can see that in my program i have only the directories hello stats test but i don't have the files in the root: htaccess.config swp txt 1.txt 2.png....all this files i don't have it on my treeView.
What i want it to be is that on my program on the treeView i will also display the files like in my ftp server.
I see in my program only the directories and the files in the directories but i don't see the files on the root directory/node.
I need it to be like in my ftp server i need to see in my program the htaccess 1.txt 2.png and so on.
So what i wrote in my main question is that in the var files i see this files of the root directory i just don't know to add and display them in my treeView(my treeView is treeViewMS1).
I know i checked in my program in the method CreateDirectoryNode i see in the first iteration of the recursive that var files contain this root files i just dont know how to add and display them in my treeView.
On the next iterations when it does the recursive it's adding the directories hello stats test and the files in this directories but i need it to first add the root files.

Similar Messages

  • HT201068 In the Ap Store "Updates" window, it says that "Remote Desktop Client Update" was installed today.  I never intentionally installed "Remote Desktop".  How did it get there, Where is it on my computer, and How can I remove it?  Thank You!

    In the Ap Store "Updates" window, it says that "Remote Desktop Client Update" was installed today.  I never intentionally installed "Remote Desktop".  How did it get there, Where is it on my computer, and How can I remove it?  Thank You!

    I don't know if you have been there, but a very suspicious icon!  (Like this one on a NSA satellite: http://b-i.forbesimg.com/kashmirhill/files/2013/12/Satellite-logo-for-spying.jpg)  Yikes!
    Are they after the French too?!?  I thought we were allies?!?  Wait a minute . . . I'm an American citizen with the Constitutional Right (which they vowed to uphold when they took their job!) of privacy!!!
    What do you think of all this?
    How did you find it in the OS?
    Do I just trash it with "Secure Empty"?

  • I accidentally deleted an Application on my iphone 5 and with it lost important files. How do i get back these files. The last iphone backup sync was after this so I cant even access an older back up as I cannot find them. How do I get back my Lost files.

    I accidentally deleted an Application on my iphone 5 and with it lost important files. How do i get back these files. The last iphone backup sync was after this so I cant even access an older back up as I cannot find them. How do I get back my Lost files.

    On your iMac launch iTunes and at the top next to the Apple symbol click iTunes > Preferences > Devices and tell me what you see. You last sync should be there showing only a device name. If you have an older backup it will be there as well the difference is it will be the device name with a date and time stamp. Sync and backups are two different things and there is a chance iTunes made a backup the first time you hooked up your iPhone 5. 

  • How do I get an SVG file to the same color profile as my illustrator file (U.S. Web Coated (SWOP) v2 and what would be the correct color profile for printing on a shirt?

    How do I get an SVG file to the same color profile as my illustrator file (U.S. Web Coated (SWOP) v2 and what would be the correct color profile for printing on a shirt?
    Thank you.

    dadanas wrote:
    Hi Simcah, I have a similar problem. Have you found out any solution?
    thanks, dan
    You need to ask the printing service provider. Dealing with color totally depends on the printing process involved and of course the machines used.

  • When I try to back up my hard drive to an external hard drive if an alias is not correct or a file is not recognised it fails and I cannot tell the sytem to ignore the file. Anyone know why and how I can get around the problem?

    Hi
    I have a Mac PowerBook G4 running OSX and a Hitachi external HD.  When I try to back up the data from my Mac to the HD it copies much of the data across but some files such as incorrect "alias' files and some other files do not copy.  The messages I get indicate there are problems but when I click the OK button the backup stops.  I then have to either delete these files or copy other files with correct alias details to overwrite the existing one. I then have to start the backup all over.
    I have been carrying out a bfull backup so have been copyiing the hard drive of the Mac an pasting it into the external HD.  Is this my problem? If so how do i carry out the backup function. I have been informed by Hitachi that I should be using the Mac's own "Time Machine" software but I don't seem to be able to locate this.
    I have been told that there should be the option to either cancel the backup or skip the file but I don't get that. 
    Any ideas as I am running out of patience.
    vic

    If you are running Tiger, you don't have time machine. 
    You need to get something like SuperDuper! or Carbon Copy Cloner (sorry, I don't have a handy link for CCC but you can Google it to get their site) to make a clone of your drive on the external and then do incremental backups.  The free versions do a lot and you can upgrade to the full-service versions for small change if you need more.  The one time I used SuperDuper! for cloning a volume it worked just fine. 
    (My backup application is the last PPC capable version of Retrospect, which does a credible job, or has over the past ten-twelve years.)

  • How do I get iWeb to publish just the files to my root directory

    Hey all, when I publish my site to my hosting server via iWeb it's just copying the entire folder into my root directory instead of copying the files to the root directory. This is causing my site url to look like this: www.mysite.com/myfolder/ how do I get iWeb to publich the files in the "myfolder" to my server instead of the entire folder?

    I needed to do this while keeping ftp publishing inside iWeb, and so I developed a sneaky solution. I just figured this out, so there may be some extra steps in here. Here goes:
    Find the iWeb application on the computer you are publishing from.
    Control-Click on the application and choose "Show Package Contents".
    In the window that appears, open the folder "Contents".
    Control-Click on the folder "Resources" and choose "Get Info".
    In the window that appears, open the "Sharing and Permissions" drop-down.
    Click the lock in the lower-right corner and enter your password.
    Where it says "Read Only" across from "Everyone", click the arrows and choose "Read and Write".
    Close the "Info" window and open the "Resources" folder.
    Find the "defaultPublishConfiguration.plist" file and change the permissions (repeat steps 4-7 but with "defaultPublishConfiguration.plist" instead of the "Resources" folder).
    Open the "defaultPublishConfiguration.plist" file in TextEdit.
    Find the line "<string>/Web/Sites</string>".
    Change it to "<string>/Web</string>".
    Save and close the text file.
    Restart iWeb.
    Go to your publishing settings and enter the information for your server. Point the "Directory/Path" to the folder above your server's root web folder.
    Set "Site Name" to the name of your server's web folder.
    Make sure that none of the files in your server's web folder have the same name as those iWeb would upload.
    Select File>Publish Entire Site.
    It should now publish your site to "http://www.yourdomain.org/Home.html".
    Hope it works!
    mindoftea

  • Why can't my new Macbook Pro not see individual MTS files on the sony cx700 flash drive? How do I get AVCHD MTS files off the camera not using imovie or FCP?

    Hi,
    I bought a new MacBook Pro (OS X version 10.8) recently to replace an older version. I work with different Sony cameras (Hard drive and flash drive storage), but when I connect the cameras (Sony Cx560, 700 and XR520) to the Mac it only shows an AVCHD icon. Usually you can see the individual files. We have 3 Macbook Pro's here and on 2 of them it works. Is there a setting or a driver I need to download for this new Mac? The other ones read it without intsalling anything.
    Thanks for any tips.

    There are two (and probably more than two) third party apps that will do this.
    1) ClipWrap
    2) Voltaic

  • HT3209 My computer meets and exceeds the requirements to watch HD 1080p movies,why does it say I cannnot watch the file may be to large and how can I fix this??

       How can I fix the topic question.I can watch HD movies all day using my Bluray Player why can't iTunes let me watch the movies in 1080p and why does it say the movies are to large.

    This is for the Windows 8-8.1 users out there:  If you have the Pro version of Windows 8 and just recently upgraded to 8.1, Microsoft automatically includes a Virtual Machine package called Hyper-V client.  It doesn't ask you if you want to install it, it just does.
    This may also apply to Windows 7 users who may have inadvertently installed some version of Hyper-V on their computer.
    The Hyper-V package installs a secondary video driver that breaks HDCP, which means you can't play HD movies even on a compliant system.  You need to get rid of it.  To do so:
    Go to Control Panel
    Programs and Features
    Turn Windows Features on or Off
    Uncheck "Hyper-V"
    Reboot.
    This applies to almost anything that requires HDCP, so if you're having trouble with Blu-Rays or Amazon Prime, that's likely the culprit.

  • How do I get an XML file on the client side hard drive

    Is there a way to get XML files from a Flex form and get it
    to the hard drive on the client side? I realize Microsoft got
    impaled by allowing this sort of thing with ActiveX. We would like
    the app to be browser based but need XML files dropped off on the
    hard drive. There is an application running locally that needs to
    consume them. Can I run flex standalone without web services and
    still access the hard drive? Seems robust enough to do so.

    dadanas wrote:
    Hi Simcah, I have a similar problem. Have you found out any solution?
    thanks, dan
    You need to ask the printing service provider. Dealing with color totally depends on the printing process involved and of course the machines used.

  • How can I get my Bokmarks back after losing them when I had an update for an add on?

    After I installed an update for an add on, I opened Firefox and I found that even though all of the Folders were still there, under Bookmarks, all of the bookmarks were gone. Is there any way that I can get them back?

    This can be a problem with the file places.sqlite that stores the bookmarks and the history.
    See:
    * http://kb.mozillazine.org/Locked_or_damaged_places.sqlite
    * http://kb.mozillazine.org/Lost_bookmarks

  • How do I get numbers app files to synchronize between ipad and iphone?

    Does anyone know how to adjust the settings on iCloud or the Numbers App itself to allow files created and modified using the Numbers App to automatically make and save any corrections made to the files on any other device on which you have the Numbers App installed and that are connected to the same itunes/iCloud account. I had my devices set-up where this happened but I had to reset them to factory settings and lost this ability. Your help is greatly appreciate. Thanks in advance.

    First, both your devices shoulde be using the same Apple ID account.
    Second make sure that the "Documents and Data" option under iCloud settings are set ON for both devices.
    That should make it work.

  • How do you get an xml file from the PO Output for Communication report?

    Can anyone tell me how you've created an xml output fil for this program? When I run it, the View XML button doesn't light up, and the output file is empty.
    I can see the XML when I click the View Log button, but can't figure out how to save it so that the XMLP Desktop tool can load it properly.
    If you can tell me how to create this file, I'd be very appreciative.

    Hi,
    I can't see the xml in my log file. Maybe you have a different logging level. One issue I have had before is that the xml declaration had a strange character encoding. It should say something like: <?xml version="1.0" ?>. If it mentions anything about encoding you can remove it.
    One of our developers wrote a custom process to write the xml to a table when the document was generated as we couldn't find any other way of doing it.
    You can use the sample xml available from the data definition but this is missing fields.
    Probably not much help...
    Paul

  • Once I have a domain name how do I get DW's files on the web? [subject edited by moderator]

    So here is the back story.
    I recently purchased a domain name from google domains.
    I then started to try and learn how to make a website in dreamweaver.
    What i need help with is not the building website part but after you have your website completed in dreamweaver how do you host it under the domain name you have purchased?

    If your arrangement with Google includes hosting, they will provide you with the information you will need to enter into the remote settings when you define your site in DW.
    If you secure hosting elsewhere, the provider will give you their server information for your site definition.

  • Can I get a refund on a game I purchased and downloaded in Itunes for my Ipod Touch 4g?

    Would like to know if I can get a refund for a game purchased and download in Itunes on my Ipod Touch 4g that wasnt what I thought it would be and I dont like the game. Hope Im not stuck with it.

    All sales are final.  It sounds like you did notdo yourhomewok before yu purchased the app.  That is not Apple's fault.

  • When I look up the creation date for files on my Macbook I get the date and month in brackets, but not the year.  Why is this and how can I look up the year?

    When I look up the creation date for files on my Macbook (using "get info", or the information window in Iphoto) I get the date and month in brackets, but not the year.  Why is this and how can I look up the year? 

    Does the Date Modified column in a window set to List view show the date correctly, or does it also display it incorrectly?
    To add additional columns to a Finder (folder) window, with that window open and active open the View Options for it. You can do that by pressing Command-J or by selecting View Options from the View menu in the main menubar.

Maybe you are looking for