如何检查磁盘空间 [英] How to check disk space

查看:106
本文介绍了如何检查磁盘空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


大家好,

Hi All,

我通过递归调用复制文件和目录...

I am copying file and directories through recursive call...

我需要在这些递归调用中检查磁盘空间....

I need to check the disk space in these recursive call....

那我怎么检查呢???如果磁盘空间较小且文件大小较多,则需要显示错误消息

So how can I check that ??? If disk space is less and file size is more then need to show the error message

我该怎么做?

问候,

Rohit

推荐答案

这有助于开始?

Does this help as start ?

    Dim freeSpace As Long = My.Computer.FileSystem.GetDriveInfo("C:\").TotalFreeSpace
        MessageBox.Show(freeSpace)

        Dim fileInfo As New FileInfo("c:\temp\data.txt")
        MessageBox.Show(fileInfo.Length)

        If freeSpace - fileInfo.Length > 0 Then
            ''Copy
        Else
            ''Display your message

        End If


这篇关于如何检查磁盘空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆