Copy codeThe Code is as follows: #-*-encoding: utf8 -*-
Import OS
Import sys
Import ftplib
Class FTPSync (object ):
Def _ init _ (self ):
Self. conn = ftplib. FTP ('10. 22.33.46 ', 'user', 'pass ')
Self. conn. cwd ('/') # remote FTP directory
OS. chdir ('/data/') # local download directory
Def get_dirs_files (self ):
U''' to get the current directory and file, and put it in the dir_res list '''
Dir_res = []
Self. conn. dir ('.', dir_res.append)
Files
think is the best. As usual, your opinions are also important.20. FTPSync
By default, SublimeText does not provide FTP functions. If you are looking for a free and easy-to-use FTP tool that can be used in your SublimeText application, you can consider FTPSync. This is a very simple FTP synchronization tool that can control multiple renaming of upload targets. Let us know what you think.19. SASS Build
SASS
This article describes a Python implementation method that supports directory FTP upload and download files. Share to everyone for your reference. Specific as follows:
The program supports FTP uploads to download files and directories, for Windows and Linux platforms.
#!/usr/bin/env python#-*-coding:utf-8-*-import ftplibimport osimport sysclass Ftpsync (object): conn = Ftplib. FTP () def __init__ (self,host,port=21): Self.conn.connect (host,port) def
, //"ssh_key_file": "~/.ssh/id_rsa", //"sftp_flags": ["-F", "/path/to/ssh_config"], //"preserve_modification_times": false, //"remote_time_offset_in_hours": 0, //"remote_encoding": "utf-8", //"remote_locale": "C",}
Save and connect. The following describes how to upload a project:
In the toolbar, click Project-add folder to project... and select the project folder. In this way, the project folder appears on the left side, right-click the project, select
",
//"dir_permissions": "775",
//"extra_list_connections": 0,
"connect_ Timeout ":",
//"keepalive": A,/
/"Ftp_passive_mode": true,
//"Ssh_key_file": "~/.ssh/id_rsa",
//"Sftp_flags": ["F", "/path/to/ssh_config"],
//"Preserve_modification_times": false,
//"Remote_ Time_offset_in_hours ": 0,
//" remote_encoding ":" Utf-8 ",
//" Remote_locale ":" C ",
}
Then save it so that you can connect it. The following is an introduction to upload a proje
what this article will discuss. Not much nonsense, let's take a look at 20 powerful Sublimetext plugins. If you are already using them, please let us know and tell us what you think is the best one. As always, your opinion is important.Ftpsync.By default Sublimetext does not feature FTP, and if you are looking for a free and easy-to-use FTP tool that can be used in your Sublimetext application, you can consider ftpsync. This is a very simple FTP sync
This article mainly introduces how to compile a Python script to implement the simplest FTP download tutorial. It mainly uses the ftplib module and has no graphical interface... if you need a friend, refer to accessing FTP. There are only two things: upload and download. Recently, you need to download a large number of files from ftp in the project. Then I tried to experiment with my ftp operation class, as shown in the following figure (PS: This section has a problem. Do not copy and use it. Re
Access to FTP, nothing more than two things: upload and download, recently in the project need to download a large number of files from FTP, and then I tried to experiment with their own FTP operation class, as follows (PS: This paragraph has a problem, do not copy the use, you can refer to test their own FTP class!) )
Import osfrom ftplib Import FTP class Ftpsync (): Def __init__ (self, host, usr, PSW, log_file): Self.host = Host self.usr = usr SELF
Access to FTP, nothing more than two things: upload and download, recently in the project need to download a large number of files from FTP, and then I tried to experiment with their own FTP operation class, as follows (PS: This paragraph has a problem, do not copy the use, you can refer to test their own FTP class!) )
Import osfrom ftplib Import FTP class Ftpsync (): Def __init__ (self, host, usr, PSW, log_file): Self.host = Host Sel f.usr = usr SE
Contact Us
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.