【问题标题】:C#/.NET: Retrieving the contents/file attributes from a file inside a recycle binC#/.NET:从回收站内的文件中检索内容/文件属性
【发布时间】:2011-02-09 03:01:03
【问题描述】:

我只想问是否有可能以编程方式从回收站中检索“转储”文件的内容。我要查找的内容是文件属性,例如“上次修改日期”、“创建数据”、“大小”等(不将文件本身恢复到原始位置以保留在回收站中找到的原始属性。)

【问题讨论】:

    标签: .net windows file recycle-bin file-attributes


    【解决方案1】:

    这个article 应该可以帮助你。正如那家伙在他的文章中指出的那样,肯定有P/Invoke 解决方案,但他找不到。

    【讨论】:

    • @Petar:好文章。您认为“修改日期”是否也包括在内?
    【解决方案2】:

    有一个不直接的 c# 解决方案。 P/Invoke 调用是其中一种方式。

    应用程序经常使用的回收站和其他特殊文件夹的位置可以通过CSIDL(Shell)来识别。对于回收站,使用的枚举是 CSIDL_BITBUCKET。 CSIDL 与四个 Shell 函数之一(SHGetFolderLocation、SHGetFolderPath、SHGetSpecialFolderLocation 和 SHGetSpecialFolderPath)结合使用,以检索特殊文件夹的路径。

    C++ 实现可以在这里找到:How to programmatically use the Recycle Bin

    一些 c# 示例。

    Recycle Bin file size and file count.
    Empty Recycle Bin

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-08
      • 2021-06-07
      • 2023-02-03
      • 2023-03-28
      • 1970-01-01
      • 1970-01-01
      • 2020-05-30
      相关资源
      最近更新 更多