외부 FTP에 있는 파일들을 Linux 서버로 다운로드 받아야하는 상황이다. 구현 방법에는 여러가지가 있지만 wget
명령어를 통해 특정 파일 또는 디렉토리에 있는 파일들을 한 번에 받는 방법이 있다.
특정 파일 다운로드
wget --user={username} --password={password} ftp://{host}/{directory_path}/{file_path} -O {download_path}
# Example (FTP경로 /picture/20211015/01.jpg 파일 다운로드하는 경우)
wget --user=user1 --password=test1234 ftp://111.222.333.444/picture/20211015/01.jpg -O ~/download/01.jpg
특정 폴더 내 전체 다운로드
특정 폴더 내에 있는 모든 파일을 다운로드하는 방법은 mirror
옵션을 사용하면 됨. (Root 가능)
wget -m --user={username} --password={password} ftp://{host}/{directory_path} -O {download_directory_path}
# Example (FTP경로 /picture/20211015 내 모든 파일을 다운로드)
wget -m --user=user1 --password=test1234 ftp://111.222.333.444/picture/20211015
# background 다운로드
wget -m --user=user1 --password=test1234 ftp://111.222.333.444/picture/20211015 -b
'Programming > Linux' 카테고리의 다른 글
Unzip 'End-of-central-directory signiture not found' 압축해제 오류 (0) | 2022.10.05 |
---|---|
Linux 파일명에서 dash(-) 지우기 (1) | 2022.10.05 |
Shell 따옴표 처리 (quote escape) (0) | 2022.10.05 |
iTerms2 ssh session 공유를 통한 자동 로그인 (0) | 2022.10.05 |
[Linux/shell] find 명령어 정리 (0) | 2020.05.26 |
댓글