开发者

How to programmatically search for a folder in a user's environment in C#?

开发者 https://www.devze.com 2023-01-08 04:07 出处:网络
I would like to be able to search for a folder by name within a user\'s files in C#. The reason fo开发者_高级运维r this is to enable a process which utilizes two applications that are otherwise not co

I would like to be able to search for a folder by name within a user's files in C#. The reason fo开发者_高级运维r this is to enable a process which utilizes two applications that are otherwise not communicating with one another. (The process is essentially a file hand off, and the applications cannot communicate as one is a proprietary app). If this is possible, any ideas or best practices would be much appreciated.

Thanks,

badPanda


Start at root (or the root where this directory might be found) with System.IO.DirectoryInfo. Call GetDirectories to get all of the directories within this directory. Call GetDirectories recursively and compare to your desired name until you find it.

0

精彩评论

暂无评论...
验证码 换一张
取 消