目录

Get a single file from an FTP server.

Checks a single file's size and mtime from an FTP server.

Get a single file from an FTP server.but also stores the received response-lines

Get a single file from an FTPS server.2

Performs an FTP upload and renames the file just after a successful transfer.

FTP upload a file from memory

Upload to FTP, resuming failed transfers.


Get a single file from an FTP server.

/****************************************************************************                                  _   _ ____  _*  Project                     ___| | | |  _ \| |*                             / __| | | | |_) | |*                            | (__| |_| |  _ <| |___*                             \___|\___/|_| \_\_____|** Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.** This software is licensed as described in the file COPYING, which* you should have received as part of this distribution. The terms* are also available at https://curl.haxx.se/docs/copyright.html.** You may opt to use, copy, modify, merge, publish, distribute and/or sell* copies of the Software, and permit persons to whom the Software is* furnished to do so, under the terms of the COPYING file.** This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY* KIND, either express or implied.****************************************************************************/
#include <stdio.h>#include <curl/curl.h>/* <DESC>* Get a single file from an FTP server.* </DESC>*/struct FtpFile {const char *filename;FILE *stream;
};static size_t my_fwrite(void *buffer, size_t size, size_t nmemb, void *stream)
{struct FtpFile *out = (struct FtpFile *)stream;if(!out->stream) {/* open file for writing */out->stream = fopen(out->filename, "wb");if(!out->stream)return -1; /* failure, can't open file to write */}return fwrite(buffer, size, nmemb, out->stream);
}int main(void)
{CURL *curl;CURLcode res;struct FtpFile ftpfile = {"testfile", /* name to store the file as if successful */NULL};curl_global_init(CURL_GLOBAL_DEFAULT);curl = curl_easy_init();if(curl) {/** You better replace the URL with one that works!*/curl_easy_setopt(curl, CURLOPT_URL,"http://10.170.6.66/testfile");/* Define our callback to get called when there's data to be written */curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, my_fwrite);/* Set a pointer to our struct to pass to the callback */curl_easy_setopt(curl, CURLOPT_WRITEDATA, &ftpfile);/* Switch on full protocol/debug output */curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);res = curl_easy_perform(curl);/* always cleanup */curl_easy_cleanup(curl);if(CURLE_OK != res) {/* we failed */fprintf(stderr, "curl told us %d\n", res);}}if(ftpfile.stream)fclose(ftpfile.stream); /* close the local file */curl_global_cleanup();return 0;
}

Checks a single file's size and mtime from an FTP server.

/****************************************************************************                                  _   _ ____  _*  Project                     ___| | | |  _ \| |*                             / __| | | | |_) | |*                            | (__| |_| |  _ <| |___*                             \___|\___/|_| \_\_____|** Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.** This software is licensed as described in the file COPYING, which* you should have received as part of this distribution. The terms* are also available at https://curl.haxx.se/docs/copyright.html.** You may opt to use, copy, modify, merge, publish, distribute and/or sell* copies of the Software, and permit persons to whom the Software is* furnished to do so, under the terms of the COPYING file.** This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY* KIND, either express or implied.****************************************************************************/
#include <stdio.h>
#include <string.h>#include <curl/curl.h>/* <DESC>* Checks a single file's size and mtime from an FTP server.* </DESC>*/static size_t throw_away(void *ptr, size_t size, size_t nmemb, void *data)
{(void)ptr;(void)data;/* we are not interested in the headers itself,so we only return the size we would have saved ... */return (size_t)(size * nmemb);
}int main(void)
{char ftpurl[] = "http://10.170.6.66/testfile";CURL *curl;CURLcode res;long filetime = -1;double filesize = 0.0;const char *filename = strrchr(ftpurl, '/') + 1;curl_global_init(CURL_GLOBAL_DEFAULT);curl = curl_easy_init();if(curl) {curl_easy_setopt(curl, CURLOPT_URL, ftpurl);/* No download if the file */curl_easy_setopt(curl, CURLOPT_NOBODY, 1L);/* Ask for filetime */curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, throw_away);curl_easy_setopt(curl, CURLOPT_HEADER, 0L);/* Switch on full protocol/debug output *//* curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); */res = curl_easy_perform(curl);if(CURLE_OK == res) {/* https://curl.haxx.se/libcurl/c/curl_easy_getinfo.html */res = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime);if((CURLE_OK == res) && (filetime >= 0)) {time_t file_time = (time_t)filetime;printf("filetime %s: %s", filename, ctime(&file_time));}res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD,&filesize);if((CURLE_OK == res) && (filesize>0.0))printf("filesize %s: %0.0f bytes\n", filename, filesize);}else {/* we failed */fprintf(stderr, "curl told us %d\n", res);}/* always cleanup */curl_easy_cleanup(curl);}curl_global_cleanup();return 0;
}

Get a single file from an FTP server.but also stores the received response-lines

/****************************************************************************                                  _   _ ____  _*  Project                     ___| | | |  _ \| |*                             / __| | | | |_) | |*                            | (__| |_| |  _ <| |___*                             \___|\___/|_| \_\_____|** Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.** This software is licensed as described in the file COPYING, which* you should have received as part of this distribution. The terms* are also available at https://curl.haxx.se/docs/copyright.html.** You may opt to use, copy, modify, merge, publish, distribute and/or sell* copies of the Software, and permit persons to whom the Software is* furnished to do so, under the terms of the COPYING file.** This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY* KIND, either express or implied.****************************************************************************/
#include <stdio.h>#include <curl/curl.h>/* <DESC>* Similar to ftpget.c but also stores the received response-lines* in a separate file using our own callback!* </DESC>*/
static size_t
write_response(void *ptr, size_t size, size_t nmemb, void *data)
{FILE *writehere = (FILE *)data;return fwrite(ptr, size, nmemb, writehere);
}#define FTPBODY "ftp-list"
#define FTPHEADERS "ftp-responses"int main(void)
{CURL *curl;CURLcode res;FILE *ftpfile;FILE *respfile;/* local file name to store the file as */ftpfile = fopen(FTPBODY, "wb"); /* b is binary, needed on win32 *//* local file name to store the FTP server's response lines in */respfile = fopen(FTPHEADERS, "wb"); /* b is binary, needed on win32 */curl = curl_easy_init();if(curl) {/* Get a file listing from sunet */curl_easy_setopt(curl, CURLOPT_URL, "http://10.170.6.66/testfile");curl_easy_setopt(curl, CURLOPT_WRITEDATA, ftpfile);/* If you intend to use this on windows with a libcurl DLL, you must useCURLOPT_WRITEFUNCTION as well */curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, write_response);curl_easy_setopt(curl, CURLOPT_HEADERDATA, respfile);res = curl_easy_perform(curl);/* Check for errors */if(res != CURLE_OK)fprintf(stderr, "curl_easy_perform() failed: %s\n",curl_easy_strerror(res));/* always cleanup */curl_easy_cleanup(curl);}fclose(ftpfile); /* close the local file */fclose(respfile); /* close the response file */return 0;
}

Get a single file from an FTPS server.2

/****************************************************************************                                  _   _ ____  _*  Project                     ___| | | |  _ \| |*                             / __| | | | |_) | |*                            | (__| |_| |  _ <| |___*                             \___|\___/|_| \_\_____|** Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.** This software is licensed as described in the file COPYING, which* you should have received as part of this distribution. The terms* are also available at https://curl.haxx.se/docs/copyright.html.** You may opt to use, copy, modify, merge, publish, distribute and/or sell* copies of the Software, and permit persons to whom the Software is* furnished to do so, under the terms of the COPYING file.** This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY* KIND, either express or implied.****************************************************************************/#include <stdio.h>#include <curl/curl.h>/* <DESC>* Get a single file from an FTPS server.* </DESC>*/struct FtpFile {const char *filename;FILE *stream;
};static size_t my_fwrite(void *buffer, size_t size, size_t nmemb,void *stream)
{struct FtpFile *out = (struct FtpFile *)stream;if(!out->stream) {/* open file for writing */out->stream = fopen(out->filename, "wb");if(!out->stream)return -1; /* failure, can't open file to write */}return fwrite(buffer, size, nmemb, out->stream);
}int main(void)
{CURL *curl;CURLcode res;struct FtpFile ftpfile = {"yourfile.txt", /* name to store the file as if successful */NULL};curl_global_init(CURL_GLOBAL_DEFAULT);curl = curl_easy_init();if(curl) {/** You better replace the URL with one that works! Note that we use an* FTP:// URL with standard explicit FTPS. You can also do FTPS:// URLs if* you want to do the rarer kind of transfers: implicit.*/curl_easy_setopt(curl, CURLOPT_URL,"http://10.170.6.66/testfile");/* Define our callback to get called when there's data to be written */curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, my_fwrite);/* Set a pointer to our struct to pass to the callback */curl_easy_setopt(curl, CURLOPT_WRITEDATA, &ftpfile);/* We activate SSL and we require it for both control and data */curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_ALL);/* Switch on full protocol/debug output */curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);res = curl_easy_perform(curl);/* always cleanup */curl_easy_cleanup(curl);if(CURLE_OK != res) {/* we failed */fprintf(stderr, "curl told us %d\n", res);}}if(ftpfile.stream)fclose(ftpfile.stream); /* close the local file */curl_global_cleanup();return 0;
}

Performs an FTP upload and renames the file just after a successful transfer.

/****************************************************************************                                  _   _ ____  _*  Project                     ___| | | |  _ \| |*                             / __| | | | |_) | |*                            | (__| |_| |  _ <| |___*                             \___|\___/|_| \_\_____|** Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.** This software is licensed as described in the file COPYING, which* you should have received as part of this distribution. The terms* are also available at https://curl.haxx.se/docs/copyright.html.** You may opt to use, copy, modify, merge, publish, distribute and/or sell* copies of the Software, and permit persons to whom the Software is* furnished to do so, under the terms of the COPYING file.** This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY* KIND, either express or implied.****************************************************************************/
#include <stdio.h>
#include <string.h>#include <curl/curl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#ifdef WIN32
#include <io.h>
#else
#include <unistd.h>
#endif/* <DESC>* Performs an FTP upload and renames the file just after a successful* transfer.* </DESC>*///#define LOCAL_FILE      "/tmp/uploadthis.txt"
//#define UPLOAD_FILE_AS  "while-uploading.txt"
//#define REMOTE_URL      "ftp://example.com/"  UPLOAD_FILE_AS
//#define RENAME_FILE_TO  "renamed-and-fine.txt"#define LOCAL_FILE      "uploadthis.txt"
#define UPLOAD_FILE_AS  "while-uploading.txt"
#define REMOTE_URL      "http://10.170.6.66/"
#define RENAME_FILE_TO  "renamed-and-fine.txt"/* NOTE: if you want this example to work on Windows with libcurl as aDLL, you MUST also provide a read callback with CURLOPT_READFUNCTION.Failing to do so will give you a crash since a DLL may not use thevariable's memory when passed in to it from an app like this. */
static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream)
{curl_off_t nread;/* in real-world cases, this would probably get this data differentlyas this fread() stuff is exactly what the library already would doby default internally */size_t retcode = fread(ptr, size, nmemb, stream);nread = (curl_off_t)retcode;fprintf(stderr, "*** We read %" CURL_FORMAT_CURL_OFF_T" bytes from file\n", nread);return retcode;
}int main(void)
{CURL *curl;CURLcode res;FILE *hd_src;struct stat file_info;curl_off_t fsize;struct curl_slist *headerlist = NULL;static const char buf_1 [] = "RNFR " UPLOAD_FILE_AS;static const char buf_2 [] = "RNTO " RENAME_FILE_TO;/* get the file size of the local file */if(stat(LOCAL_FILE, &file_info)) {printf("Couldn't open '%s': %s\n", LOCAL_FILE, strerror(errno));return 1;}fsize = (curl_off_t)file_info.st_size;printf("Local file size: %" CURL_FORMAT_CURL_OFF_T " bytes.\n", fsize);/* get a FILE * of the same file */hd_src = fopen(LOCAL_FILE, "rb");/* In windows, this will init the winsock stuff */curl_global_init(CURL_GLOBAL_ALL);/* get a curl handle */curl = curl_easy_init();if(curl) {/* build a list of commands to pass to libcurl */headerlist = curl_slist_append(headerlist, buf_1);headerlist = curl_slist_append(headerlist, buf_2);/* we want to use our own read function */curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);/* enable uploading */curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);/* specify target */curl_easy_setopt(curl, CURLOPT_URL, REMOTE_URL);/* pass in that last of FTP commands to run after the transfer */curl_easy_setopt(curl, CURLOPT_POSTQUOTE, headerlist);/* now specify which file to upload */curl_easy_setopt(curl, CURLOPT_READDATA, hd_src);/* Set the size of the file to upload (optional).  If you give a *_LARGEoption you MUST make sure that the type of the passed-in argument is acurl_off_t. If you use CURLOPT_INFILESIZE (without _LARGE) you mustmake sure that to pass in a type 'long' argument. */curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE,(curl_off_t)fsize);/* Now run off and do what you've been told! */res = curl_easy_perform(curl);/* Check for errors */if(res != CURLE_OK)fprintf(stderr, "curl_easy_perform() failed: %s\n",curl_easy_strerror(res));/* clean up the FTP commands list */curl_slist_free_all(headerlist);/* always cleanup */curl_easy_cleanup(curl);}fclose(hd_src); /* close the local file */curl_global_cleanup();return 0;
}

FTP upload a file from memory

/****************************************************************************                                  _   _ ____  _*  Project                     ___| | | |  _ \| |*                             / __| | | | |_) | |*                            | (__| |_| |  _ <| |___*                             \___|\___/|_| \_\_____|** Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.** This software is licensed as described in the file COPYING, which* you should have received as part of this distribution. The terms* are also available at https://curl.haxx.se/docs/copyright.html.** You may opt to use, copy, modify, merge, publish, distribute and/or sell* copies of the Software, and permit persons to whom the Software is* furnished to do so, under the terms of the COPYING file.** This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY* KIND, either express or implied.****************************************************************************/
/* <DESC>* FTP upload a file from memory* </DESC>*/
#include <stdio.h>
#include <string.h>
#include <curl/curl.h>static const char data[]="Lorem ipsum dolor sit amet, consectetur adipiscing elit. ""Nam rhoncus odio id venenatis volutpat. Vestibulum dapibus ""bibendum ullamcorper. Maecenas finibus elit augue, vel ""condimentum odio maximus nec. In hac habitasse platea dictumst. ""Vestibulum vel dolor et turpis rutrum finibus ac at nulla. ""Vivamus nec neque ac elit blandit pretium vitae maximus ipsum. ""Quisque sodales magna vel erat auctor, sed pellentesque nisi ""rhoncus. Donec vehicula maximus pretium. Aliquam eu tincidunt ""lorem.";struct WriteThis {const char *readptr;size_t sizeleft;
};static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *userp)
{struct WriteThis *upload = (struct WriteThis *)userp;size_t max = size*nmemb;if(max < 1)return 0;if(upload->sizeleft) {size_t copylen = max;if(copylen > upload->sizeleft)copylen = upload->sizeleft;memcpy(ptr, upload->readptr, copylen);upload->readptr += copylen;upload->sizeleft -= copylen;return copylen;}return 0;                          /* no more data left to deliver */
}int main(void)
{CURL *curl;CURLcode res;struct WriteThis upload;upload.readptr = data;upload.sizeleft = strlen(data);/* In windows, this will init the winsock stuff */res = curl_global_init(CURL_GLOBAL_DEFAULT);/* Check for errors */if(res != CURLE_OK) {fprintf(stderr, "curl_global_init() failed: %s\n",curl_easy_strerror(res));return 1;}/* get a curl handle */curl = curl_easy_init();if(curl) {/* First set the URL, the target file */curl_easy_setopt(curl, CURLOPT_URL,"ftp://example.com/path/to/upload/file");/* User and password for the FTP login */curl_easy_setopt(curl, CURLOPT_USERPWD, "login:secret");/* Now specify we want to UPLOAD data */curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);/* we want to use our own read function */curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);/* pointer to pass to our read function */curl_easy_setopt(curl, CURLOPT_READDATA, &upload);/* get verbose debug output please */curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);/* Set the expected upload size. */curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE,(curl_off_t)upload.sizeleft);/* Perform the request, res will get the return code */res = curl_easy_perform(curl);/* Check for errors */if(res != CURLE_OK)fprintf(stderr, "curl_easy_perform() failed: %s\n",curl_easy_strerror(res));/* always cleanup */curl_easy_cleanup(curl);}curl_global_cleanup();return 0;
}

Upload to FTP, resuming failed transfers.

/****************************************************************************                                  _   _ ____  _*  Project                     ___| | | |  _ \| |*                             / __| | | | |_) | |*                            | (__| |_| |  _ <| |___*                             \___|\___/|_| \_\_____|** Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.** This software is licensed as described in the file COPYING, which* you should have received as part of this distribution. The terms* are also available at https://curl.haxx.se/docs/copyright.html.** You may opt to use, copy, modify, merge, publish, distribute and/or sell* copies of the Software, and permit persons to whom the Software is* furnished to do so, under the terms of the COPYING file.** This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY* KIND, either express or implied.****************************************************************************/
/* <DESC>* Upload to FTP, resuming failed transfers.* </DESC>*/#include <stdlib.h>
#include <stdio.h>
#include <curl/curl.h>/* parse headers for Content-Length */
static size_t getcontentlengthfunc(void *ptr, size_t size, size_t nmemb,void *stream)
{int r;long len = 0;r = sscanf(ptr, "Content-Length: %ld\n", &len);if(r)*((long *) stream) = len;return size * nmemb;
}/* discard downloaded data */
static size_t discardfunc(void *ptr, size_t size, size_t nmemb, void *stream)
{(void)ptr;(void)stream;return size * nmemb;
}/* read data to upload */
static size_t readfunc(void *ptr, size_t size, size_t nmemb, void *stream)
{FILE *f = stream;size_t n;if(ferror(f))return CURL_READFUNC_ABORT;n = fread(ptr, size, nmemb, f) * size;return n;
}static int upload(CURL *curlhandle, const char *remotepath,const char *localpath, long timeout, long tries)
{FILE *f;long uploaded_len = 0;CURLcode r = CURLE_GOT_NOTHING;int c;f = fopen(localpath, "rb");if(!f) {perror(NULL);return 0;}curl_easy_setopt(curlhandle, CURLOPT_UPLOAD, 1L);curl_easy_setopt(curlhandle, CURLOPT_URL, remotepath);if(timeout)curl_easy_setopt(curlhandle, CURLOPT_FTP_RESPONSE_TIMEOUT, timeout);curl_easy_setopt(curlhandle, CURLOPT_HEADERFUNCTION, getcontentlengthfunc);curl_easy_setopt(curlhandle, CURLOPT_HEADERDATA, &uploaded_len);curl_easy_setopt(curlhandle, CURLOPT_WRITEFUNCTION, discardfunc);curl_easy_setopt(curlhandle, CURLOPT_READFUNCTION, readfunc);curl_easy_setopt(curlhandle, CURLOPT_READDATA, f);/* disable passive mode */curl_easy_setopt(curlhandle, CURLOPT_FTPPORT, "-");curl_easy_setopt(curlhandle, CURLOPT_FTP_CREATE_MISSING_DIRS, 1L);curl_easy_setopt(curlhandle, CURLOPT_VERBOSE, 1L);for(c = 0; (r != CURLE_OK) && (c < tries); c++) {/* are we resuming? */if(c) { /* yes *//* determine the length of the file already written *//** With NOBODY and NOHEADER, libcurl will issue a SIZE* command, but the only way to retrieve the result is* to parse the returned Content-Length header. Thus,* getcontentlengthfunc(). We need discardfunc() above* because HEADER will dump the headers to stdout* without it.*/curl_easy_setopt(curlhandle, CURLOPT_NOBODY, 1L);curl_easy_setopt(curlhandle, CURLOPT_HEADER, 1L);r = curl_easy_perform(curlhandle);if(r != CURLE_OK)continue;curl_easy_setopt(curlhandle, CURLOPT_NOBODY, 0L);curl_easy_setopt(curlhandle, CURLOPT_HEADER, 0L);fseek(f, uploaded_len, SEEK_SET);curl_easy_setopt(curlhandle, CURLOPT_APPEND, 1L);}else { /* no */curl_easy_setopt(curlhandle, CURLOPT_APPEND, 0L);}r = curl_easy_perform(curlhandle);}fclose(f);if(r == CURLE_OK)return 1;else {fprintf(stderr, "%s\n", curl_easy_strerror(r));return 0;}
}int main(void)
{CURL *curlhandle = NULL;curl_global_init(CURL_GLOBAL_ALL);curlhandle = curl_easy_init();upload(curlhandle, "ftp://user:pass@example.com/path/file", "C:\\file",0, 3);curl_easy_cleanup(curlhandle);curl_global_cleanup();return 0;
}

C语言curl实现FTP上传、下载、获取文件信息相关推荐

  1. 使用.net FtpWebRequest 实现FTP常用功能 上传 下载 获取文件列表 移动 切换目录 改名 ....

    平时根本没时间搞FTP什么的,现在这个项目需要搞FTP,为什么呢,我给大家说下项目背景,我们的一个应用程序上需要上传图片,但是用户部署程序的服务器上不让上传任何东西,给了我们一个FTP账号和密码,让我 ...

  2. linux curl 命令 http请求、下载文件、ftp上传下载

    1. curl 命令简介 cURL(CommandLine Uniform Resource Locator),是一个利用 URL 语法,在命令行终端下使用的网络请求工具,支持 HTTP.HTTPS. ...

  3. FTP上传下载工具(FlashFXP) v5.5.0 中文版

    软件名称: FTP上传下载工具(FlashFXP) 软件语言: 简体中文 授权方式: 免费试用 运行环境: Win 32位/64位 软件大小: 7.4MB 图片预览: 软件简介: FlashFXP 是 ...

  4. 高可用的Spring FTP上传下载工具类(已解决上传过程常见问题)

    点击上方"方志朋",选择"设为星标" 回复"666"获取新整理的面试文章 作者:宇的季节 cnblogs.com/chenkeyu/p/80 ...

  5. python get 下载 目录_python实现支持目录FTP上传下载文件的方法

    本文实例讲述了python实现支持目录FTP上传下载文件的方法.分享给大家供大家参考.具体如下: 该程序支持ftp上传下载文件和目录.适用于windows和linux平台. #!/usr/bin/en ...

  6. linux ftp上传下载文件,Linux下ftp命令上传下载文件

    命令行下连接ftp服务器 方式一: 默认端口 ftp hostname 方式二: 指定端口 [ec2-user@ip-99-240-80-144 ~]$ ftp ftp> open 99.240 ...

  7. linux的ftp下载假死,记一次commons-net FTP上传下载卡死

    在利用apache的commons-net包,做FTP上传下载时,碰到了一个问题:在默认配置下,传输大文件会卡死. commons-net的maven依赖: commons-net commons-n ...

  8. python上传本地文件到ftp_python实现的简单FTP上传下载文件实例

    本文实例讲述了python实现的简单FTP上传下载文件的方法.分享给大家供大家参考.具体如下: python本身自带一个FTP模块,可以实现上传下载的函数功能. #!/usr/bin/env pyth ...

  9. java ftp上传文件_jaVA使用FTP上传下载文件的问题

    为了实现 FTP上传下载,大概试了两个方法 sun.net.ftp.FtpClient org.apache.commons.net 一开始使用sun.net.ftp.FtpClient,结果发现唯一 ...

最新文章

  1. JFreeChart_API
  2. .NET Core实战项目之CMS 第十二章 开发篇-Dapper封装CURD及仓储代码生成器实现...
  3. ECshop在文章列表页调用文章简介
  4. vSphere虚拟化之ESXi安装及部署
  5. C primer plus -- Chapter 2
  6. bzoj 3875: [Ahoi2014Jsoi2014]骑士游戏【dp+spfa】
  7. xml布局显示需要预判断,可是还没有show出来,怎么办?
  8. caffe学习(一):开发环境搭建,编译caffe(win10)
  9. iptables基本配置方法
  10. 基于vue自动化表单实践
  11. 阻塞队列BlockingQueue用法
  12. netduino之电源参考电路MC33269DT-5.0G
  13. java 自动生成mybatis文件_如何自动生成Mybatis的Mapper文件详解
  14. 文件权限管理命令chmod,chown与文本搜索命令grep
  15. android selector的item属性
  16. CRNN论文翻译——中文版
  17. pycharm社区版创建flask项目
  18. java 6 17 32_java学习class6(1)
  19. 【无标题】三星Xpress M2020打印机刷免芯片
  20. CFile记录日志——写各种数据类型的日志(CFile读写包括编码UTF-8)

热门文章

  1. 划分子网后的三级结构
  2. leetcode题解136-只出现一次的数字
  3. Solr学习总结(四)Solr查询参数
  4. HDFS文件系统的JAVA-API操作(一)
  5. ios---NSNotificationCenter传值
  6. jQuery源码解读三选择器
  7. Smarty模板引擎技术二
  8. Java 程序 ——感想
  9. VC中_T()与L区别(转)
  10. 常用电源芯片特性大集合