[파워쉘] FTP 파일 업로드(file upload) 스크립트
2018. 12. 14. 14:59ㆍIT
파워쉘로 FTP를 이용하여 파일업로드를 할 케이스가 발생하였다.
어찌어찌하여 짜 본 스크립트다.
#업로드 경로(전송할 파일 위치)
$Dir="D:/www/attend/"
#ftp정보
$ftp = "ftp://ftp주소/"
$user = "ftp아이디"
$pass = "ftp패스워드"
$webclient = New-Object System.Net.WebClient
$webclient.Credentials = New-Object System.Net.NetworkCredential($user,$pass)
foreach($item in (dir $Dir "*.*")){
"Uploading $item..."
$uri = New-Object System.Uri($ftp+$item.Name)
$webclient.UploadFile($uri, $item.FullName)
}
'IT' 카테고리의 다른 글
| [유틸리티] 무료 빠른파일검색 툴 Everything(에브리씽) (0) | 2019.05.24 |
|---|---|
| [유틸리티] 윈도우 업데이트 툴(Windows Update MiniTool) (0) | 2019.05.20 |
| [ASP] https와 http간 세션(session)공유 안될때 (0) | 2018.12.14 |
| [PHP] 텍스트(txt)파일로그 남기기 함수 (0) | 2018.12.10 |
| [유틸리티] 인터넷속도측정(netmonitoring) (0) | 2018.12.07 |