如何使用C#删除远程计算机中的文件夹 [英] how to delete a folder in a remote machine using c#

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

问题描述


我想在Winform程序中删除远程计算机中的文件夹.请帮助我,欢迎提出任何想法,请详细说明.

我可以使用WMI运行远程file.bat来删除文件夹.如果可以的话,我该怎么做?

--thank you

解决方案

以下代码对我有用:

 Directory.Delete( @" ); 



有关说明,请参见: Directory.Delete方法(字符串)

当然,您需要删除远程计算机上的文件夹的权限:)


我使用WMI来远程文件或文件夹


hi
I want to delete a folder in a remote machine in my winform program. Please help me, every idea is welcome, please say in detail.

Can I use WMI to run a remote file.bat to delete the folder. And if I can, how can i do it?

--thank you

解决方案

Following code works for me:

Directory.Delete(@"\\ip-adress-or-computer-name\path-to-folder");



For a description look here: Directory.Delete Method (String)

Of course, you need the right to delete a folder on the remote machine :)


I use WMI to remote file or folder


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

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