c# get all filenames without path from a folder and store them and revrence by a matched string RRS feed

  • Question

  • ok i have a folder full of XANIMBIN files and i want to just get the names of them so for example 


    and i want to look for say ads_up and it have the whole elfenlied_agur_ads_up file 

    so i can make a list of all anims in this folder and assign them to certin area in a text file so something like 

    string ads_up_anim {get; set;} 

    and in the forloop when it comes across that it will store it in a vauable i can call somewhere else like this 

    smgwep["ads_upanim"] = ads_up_anim; 

    and need to do that for all anim files but not sure how to accumplish this is the anims in one of the folders they will all be named the same at the end like idle, ads_up, ads_down, putaway, pullout, ect and those are the strings i will need to look for 

    as elfenlied is the ones i have done others change the names of anims but the one thing that stays the same is what anim it is like ads_up ect 

    this is a example 

    so like reload empty and reload and putaway all the anims here i need to save to a string and pass to a dictunary i already have populated. 

    thanks for reading hope i have explained well enough sorry i have dylexier so explaining is not easy 

    Monday, July 15, 2019 3:22 PM

All replies

  • Check and adjust this example:

    string folder = @"C:\. . .\Call of Duty Black Ops II\. . .\augur"; // TODO: use the correct path
    string ads_up_anim = new DirectoryInfo( folder ).EnumerateFiles( "*ads_up.XANIM_BIN" ).Select( f => f.Name ).First( );
    // if you want to remove the ".XANIM_BIN" extension:
    ads_up_anim = Path.GetFileNameWithoutExtension( ads_up_anim );

    Monday, July 15, 2019 7:36 PM
  • Hi

    Is your problem solved? If so, please post "Mark as answer" to the appropriate answer. So that it will help other members to find the solution quickly if they face the similar issue.

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Thursday, July 18, 2019 2:36 AM