如何在FTP服务器上共享文件夹? [英] How to share the Folder on FTP Server?

查看:266
本文介绍了如何在FTP服务器上共享文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用C#程序在FTP服务器上创建了一个文件夹(DirTest)。怎样才能给所有访问用户权限并共享文件夹,以便每个人都可以使用这个文件夹。



我想用c#程序来解决这个问题。





- >我在FTP服务器上创建了文件夹使用下面给出的代码。

I have created a folder(DirTest) on FTP server using C# program. How can give the all access user permission and share the folder so that every one can use this folder.

I want this solution using c# program.


--> I Created folder on FTP Server Using given below code.

private static void CreateFTPDir()
        {
            FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create("ftp://FTPServerIP/" + "DirTest");
            request.Credentials = new NetworkCredential("anonymous", "anonymous");
            request.UsePassive = true;
            request.UseBinary = true;
            request.KeepAlive = false;
            //Console.WriteLine("Getting the response");

            request.Method = WebRequestMethods.Ftp.MakeDirectory;

            using (var resp = (FtpWebResponse)request.GetResponse())
            {
                //Console.WriteLine(resp.StatusCode);
                FTPdestinationPath = resp.ResponseUri.ToString();
            }
        }



- >如何在FTP上共享由我创建的文件夹(DirTest),以便我可以获得共享路径。

- >我的主要问题是我想将文件从源文件夹移动到FTP服务器上的目标文件夹。

我使用代码在下面给出的FTP上移动文件。

文件.Move(FTPsourcePath,FTPdestinationPath +\\+ FileName);


--> How can I shared folder(DirTest) created by me on FTP so that I can get the shared path.
--> My main question is I want to move the file from source folder to destination folder on FTP Server.
I am using code for moving the file on FTP given below.
File.Move(FTPsourcePath, FTPdestinationPath +"\\"+ FileName);

推荐答案

基本上,没有共享文件夹这样的东西。您可能会将FTP与文件共享服务混淆。



这完全由两件事定义:1)每个特定FTP服务器的配置;特别是,它定义了原则上提供的根目录,以及用户,凭证等; 2)最重要的是,你应该设置文件系统对象,文件和目录的权限;应该设置什么还取决于FTP服务器的约定。



换句话说,阅读特定FTP服务器上的文档;这些服务器的设置和功能差异很大。



-SA
Essentially, there is not such thing as "shared folder". You probably confuse FTP with file sharing service.

This is fully defined by two things: 1) configuration of each particular FTP server; in particular, it defines the root directories which are served up in principle, and also the users, credential, etc.; 2) on top of that, you should set permissions of the file system objects, files and directories; what should be set also depends on FTP server's conventions.

In other words, read documentation on your particular FTP server; the settings and features of those servers differ considerably.

—SA


这篇关于如何在FTP服务器上共享文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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