PHP ftp_rename() 함수

정의 및 사용법

ftp_rename() 함수는 FTP 서버에서 파일이나 디렉토리 이름을 변경합니다.

성공하면 true를 반환하며, 실패하면 false를 반환합니다.

문법

ftp_rename(ftp_connection,from,to)
매개변수 설명
ftp_connection 필수입니다. 사용할 FTP 연결(FTP 연결의 식별자)을 지정합니다.
from 필수입니다. 이름을 변경할 파일이나 디렉토리를 지정합니다.
to 필수입니다. 파일이나 디렉토리의 새 이름을 지정합니다.

예제

<?php
$conn = ftp_connect("ftp.testftp.com") or die("Could not connect");
ftp_login($conn,"admin","ert456");
ftp_rename($conn,"oldname.txt","newname.txt");
ftp_close($conn);
?>