Client Login Area
LiveZilla Live Chat Software
Main Menu
Results 1 to 3 of 3

Thread: Getting the directory name

  1. #1
    Verified Community Member
    Join Date
    March 8, 2010
    Location
    Lakewood, CO
    Posts
    700

    Default Getting the directory name

    Code:
    public void LoadUsers()
            {            string root = @"C:\theworld\deploy\TheWorld.Server\Data\Users\";            // create string array to store the list of folders inside the root folder            string[] userFolders;            // verify root directory exists            if (Directory.Exists(root))            {                Log.Info("User Directoy Found!");                            // get all directories inside the root directory                userFolders = Directory.GetDirectories(root);                if (userFolders.Length == 0)                {                    Log.Info("No Folders found inside the users directory");                }                else                {                    foreach (string folder in userFolders)                    {                        string folderName;                        // extract the folder name from the full path - folder name is username                        folderName = new FileInfo(folder).Directory.Name; // this returns users which is the defualt root path. I need it to return testt which is the folder inside users                        Log.Debug("Adding user to the user list");                        Log.Debug(folder + "   " + folderName);                        //Deserialize<Users>(Lists.user, folder + folderName + ".xml");                    }                }            }         }
    foldername gives user when actually i need it to give me testt which is the directory its in. Any help?
    Living to Kill, Killing to Live

    Come learn more about Project NLIXD!

  2. #2
    ASPnix Administration Chris's Avatar
    Join Date
    October 11, 2008
    Location
    Denver, Colorado
    Posts
    782

    Default

    What directory name are you trying to get?
    Christopher York
    ASPnix Administration Team
    www.aspnix.com

  3. #3
    Verified Community Member
    Join Date
    March 8, 2010
    Location
    Lakewood, CO
    Posts
    700

    Default

    There are folders in side users that some of the code grabs and puts it into a string array. I want to get those names of those folders for there is an xml file inside the file named after that users folder.

    /users
    -crzy
    - chris
    - roma

    I want to get a list of all folders such as crzy, chris, roma.
    Living to Kill, Killing to Live

    Come learn more about Project NLIXD!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •