mput
SFTP 또는 FTP 서버에 파일이나 폴더 업로드
설명
예제
파일 업로드하기
FTP 서버에 연결하고 로컬 컴퓨터에서 서버로 파일을 업로드합니다. 이 예제에서는 실제로는 존재하지 않는 컴퓨터인 ftp.example.com
에서 가상의 FTP 세션을 보여줍니다. FTP 서버에 파일을 업로드할 수 있는 권한이 있는 FTP 서버 계정이 있을 경우, 이 예제에 나온 것처럼 mput
함수를 사용할 수 있습니다.
먼저, 서버에 연결합니다.
s = ftp('ftp.example.com')
FTP with properties: Host: "ftp.example.com" Username: "anonymous" Port: 21 ServerLocale: "en_GB" DirParserFcn: @matlab.io.ftp.parseDirListingForUnix Mode: "binary" LocalDataConnectionMethod: "passive" RemoteWorkingDirectory: "/"
FTP 서버에서 현재 폴더의 내용을 표시합니다.
dir(s)
myscript.m README.txt pub
로컬 컴퓨터에서 FTP 서버로 파일을 업로드합니다.
mput(s,'myNewScript.m');
새 myNewScript.m
파일을 포함하여 FTP 서버의 업데이트된 내용을 표시합니다.
dir(s)
myscript.m myNewScript.m README.txt pub
여러 파일을 업로드합니다. 파일 이름에 공통된 텍스트가 있다면 이름의 나머지 부분과 일치하도록 와일드카드 문자(*
)를 사용할 수 있습니다. 이 예제에서는 로컬 컴퓨터의 image001.png
, image002.png
, image003.png
파일 이름과 일치하도록 와일드카드를 사용합니다.
mput(s,'image*png');
FTP 서버의 업데이트된 내용을 표시합니다.
dir(s)
image001.png image002.png image003.png myscript.m myNewScript.m README.txt pub
입력 인수
s
— SFTP 또는 FTP 서버와의 연결
SFTP 객체 | FTP 객체
SFTP 또는 FTP 서버와의 연결로, SFTP 객체 또는 FTP 객체로 지정됩니다.
contents
— 로컬 파일 또는 폴더
문자형 벡터 | string형 스칼라
로컬 파일 또는 폴더로, 문자형 벡터 또는 string형 스칼라로 지정됩니다.
로컬 컴퓨터의 여러 파일이나 폴더와 일치하도록 contents
에 와일드카드 문자(*
)를 포함시킬 수 있습니다. 예를 들어, contents
를 *.docx
로 지정하면 mput
은 이름이 .docx
로 끝나는 모든 파일을 업로드합니다.
버전 내역
R2006a 이전에 개발됨
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)