exist(x,'dir') slow for unavailable network drives
4 次查看(过去 30 天)
显示 更早的评论
I use exist(x,'dir') to check existence of a directory x. My problem is that checking existence of an address on a network drive when computer is not connected to the network takes something about 50 seconds. Checking existence of the address when computer is connected to the network however takes something about 0.0005 seconds.
I tried using
[a,b]=dos('net use x')
and I get list of connected network drives but it does not return the connected network drives as separate variable.
How can I speed up this process? I really appreciate any help!
4 个评论
回答(1 个)
per isakson
2018-11-17
编辑:per isakson
2018-11-17
I use exist(x,'dir') to check existence of a directory x. What's the value of x ?
Did you mean to run
num = exist( 'x:\', 'dir' );
which is fast enough whether 'x:\' exists or not.
3 个评论
per isakson
2018-11-17
编辑:per isakson
2018-11-17
Good question. My guess is yes.
OP writes I get list of connected network drives and I guessed that x is her/his local drive letter.
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!