如何在 C# 中以编程方式搜索用户环境中的文件夹?

发布于 2024-09-09 16:20:38 字数 163 浏览 0 评论 0原文

我希望能够在 C# 中的用户文件中按名称搜索文件夹。这样做的原因是为了启用一个使用两个应用程序的进程,否则这两个应用程序不会相互通信。 (该过程本质上是文件移交,并且应用程序无法进行通信,因为应用程序是专有应用程序)。如果这是可能的,任何想法或最佳实践将不胜感激。

谢谢,

坏熊猫

I would like to be able to search for a folder by name within a user's files in C#. The reason for 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

扎心 2024-09-16 16:20:38

使用 System.IO.DirectoryInfo 从根目录(或可能找到此目录的根目录)开始。调用 GetDirectories 以获取此目录中的所有目录。递归调用 GetDirectories 并与您想要的名称进行比较,直到找到它。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文