如何获取远程计算机中的文件数 [英] how to get count of files in a remote machine

查看:59
本文介绍了如何获取远程计算机中的文件数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



i想要计算远程机器中的文件数量。我使用这些代码:



Hi All,

i want to take the count of files in a remote machine.i used these codes:

1st method:System.IO.Directory.EnumerateFiles(path, "*.*", SearchOption.AllDirectories).Count();

2nd method:System.IO.Directory.GetFiles(path, "*.*", SearchOption.AllDirectories).Count();





使用这些来获取文件计数,但它占用了很多时间。(例如:我的远程机器包含超过50000条记录,并且需要超过3-4分钟)。我需要一个更好的解决方案,通过它我可以更快地获得计数。



请帮助



谢谢,

Elizabath



using these am getting the file count,but its taking very much time.(eg:my remote machine containing more than 50000 records and its taking more than 3-4 minuts). i need a better solution through which i will get the count even more faster.

Please help

thanks,
Elizabath

推荐答案

试试这个:

Try this:
Directory.GetFiles("\\\\RemoteMachine\\ShareName").Length;







- Amit


这篇关于如何获取远程计算机中的文件数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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