如何获取远程文件夹名称,选择它们并在C#中删除它们? [英] How to get remote folder names, select them and delete them in C#?

查看:91
本文介绍了如何获取远程文件夹名称,选择它们并在C#中删除它们?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C#中是全新的,我想在C#中做到这一点。

你能告诉我的方式:)



- 输入远程机器主机名

- 从远程机器获取C目录中的列表文件夹名称

- 从列表中选择文件夹名称

- 删除所选文件夹

- 显示有关流程的消息(已删除或未删除)



这太难了吗?感谢您提前给予我的帮助,感谢我的英语不好:(



我尝试了什么:



我尝试了第一部分。我没有把它们组合起来的信息:(

解决方案

没有C目录这样的东西即使在你的本地机器上也没有C目录这样的东西。而且,即使在你的本地Windows系统上,也只是完全忽略了, C:可能存在也可能不存在。整个想法都是错误的;这不是事情的运作方式。



一般来说,远程计算机连接到网络,没有计算机除了一些网络服务之外什么都不能访问。只有当你有足够的权限时,你才能访问其中的一些服务。服务可以切断文件或不切断文件;这取决于远程计算机的配置。



对于Windows,具体来说,您可以使用其文件共享服务,whi默认情况下,ch始终打开:启用文件和打印机共享 [ ^ ]。



文件名一般与原始远程计算机的文件系统无关,它们是UNC:统一命名惯例 - 维基百科,免费的百科全书 [ ^ ]。



设置文件名时设置目录和文件的文件共享属性。它们可能会也可能不会遵循原始文件系统结构。



如果您使用Windows文件共享。您完全使用与本地系统文件相同的方式使用共享文件 。如果您需要进行网络发现,则会有不同的故事。 CodeProject文章中描述了其中一种方法:网络共享和UNC路径 [ ^ ]。



在其他操作系统上...但为什么我要关注其他操作系统?好吧,因为你只标记了C#;您没有表明您只在Windows上工作,而且只能在Windows上工作。 C#可以在很多操作系统中使用,不是吗?好吧,简而言之:这是一个完全不同的故事。例如,请参阅:

通用文件系统和协议 - 维基百科,免费的百科全书 [ ^ ],

Samba(软件) - 维基百科,免费的百科全书 [ ^ ] ,

网络文件系统 - 维基百科,免费的百科全书 [ ^ ]。



-SA

I am brand-new in C# and I wanna do that in C#.
Can you show me the way :)

- Enter a remote machine hostname
- get list folder names in C directory from the remote machine
- select folder names from the list
- delete the selected folders
- show a message about the process (deleted or not)

Is that too hard? Thank you for your help in advance and sory for my bad English :(

What I have tried:

I tried part one part. I dont have information to combine them :(

解决方案

There is no such thing as " C directory from the remote machine". There even no such thing as "C directory", even on your local machine. And, just to dismiss the though completely, even on your local Windows system, event the volume "C:" may or may not exist. The whole idea is wrong; this is not how things works.

Generally, with remote computer connected to a network, no computer has access to nothing except some network services. You can access only to some of those services, only if you have enough privileges. And the services can sever up files or not; it depends on the configuration of a remote computer.

With Windows, specifically, you can use its file sharing service, which is always on by default: Enable file and printer sharing[^].

The file names, generally, have nothing to do with original remote computer's file system, they are UNC: Uniform Naming Convention — Wikipedia, the free encyclopedia[^].

The file names are set up when you set up file sharing properties for directories and files. They may or may not follow the original file system structure.

If you use Windows file sharing. You work with shared file exactly in the same way as with local system files. The different story would be if you need to do network discovery. One of the ways to do it is described in this CodeProject article: Network Shares and UNC paths[^].

On other OS… but why should I be concerned with other OS? Well, because you only tagged "C#"; you did not indicate that you only work on Windows and only with Windows. C# can be used in many OS, can't it? Well, in brief: this is a whole different story. For example, please see:
Common file systems and protocols — Wikipedia, the free encyclopedia[^],
Samba (software) — Wikipedia, the free encyclopedia[^],
Network File System — Wikipedia, the free encyclopedia[^].

—SA


这篇关于如何获取远程文件夹名称,选择它们并在C#中删除它们?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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