none
How can i locate a file on disk using C#? RRS feed

  • Question

  • Please let me know how can i find a file using C# code?

    Please tell me the namespaces which will b used?

     

    Sunday, June 13, 2010 9:52 AM

Answers

  • Hi Chaitanya,

    Thank you for your post.

    For your concern, you might take a further look into the DirectoryInfo and FileInfo class for folder or file handling. The namespace is System.IO.
    You can refer to the following sample code or similar concern:
    http://www.csharp-examples.net/get-files-from-directory/
    http://stackoverflow.com/questions/714101/quickest-way-in-c-to-find-a-file-in-a-directory-with-over-20-000-files

    This forum is for the support of .NET Framework installation. Since your issue is related to C# programming, you could post your thread on Visual C# General forum. This will make answer searching in the forum easier and be beneficial to other community members as well.

    Thank you for your understanding.

    Hope this helps!

    Best regards,
    Yichun Chen

    (This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.)
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by YiChun Chen Friday, June 18, 2010 3:26 AM
    Tuesday, June 15, 2010 10:31 AM
  • Hi ,

    plz see and explore this directory: System.IO.Directory

    particularly, System.IO.Directory.GetFiles(..) will be useful for it.

    Regards,


    Arif Sarwar
    • Marked as answer by YiChun Chen Friday, June 18, 2010 3:26 AM
    Tuesday, June 15, 2010 11:06 AM

All replies

  • Hi Chaitanya,

    Thank you for your post.

    For your concern, you might take a further look into the DirectoryInfo and FileInfo class for folder or file handling. The namespace is System.IO.
    You can refer to the following sample code or similar concern:
    http://www.csharp-examples.net/get-files-from-directory/
    http://stackoverflow.com/questions/714101/quickest-way-in-c-to-find-a-file-in-a-directory-with-over-20-000-files

    This forum is for the support of .NET Framework installation. Since your issue is related to C# programming, you could post your thread on Visual C# General forum. This will make answer searching in the forum easier and be beneficial to other community members as well.

    Thank you for your understanding.

    Hope this helps!

    Best regards,
    Yichun Chen

    (This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.)
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by YiChun Chen Friday, June 18, 2010 3:26 AM
    Tuesday, June 15, 2010 10:31 AM
  • Hi ,

    plz see and explore this directory: System.IO.Directory

    particularly, System.IO.Directory.GetFiles(..) will be useful for it.

    Regards,


    Arif Sarwar
    • Marked as answer by YiChun Chen Friday, June 18, 2010 3:26 AM
    Tuesday, June 15, 2010 11:06 AM