
# FTP sunucusu bilgileri
$ftpBase = “ftp://”ip adress/”
$username = “***”
$password = “*****”
$localFile = “C:UsershuseyinDesktop1.txt”
# Tarihi al ve formatla
$date = Get-Date -Format “yyyyMMdd_HHmm”
$ftpFile = “HC8_$date.csv”
$ftp = $ftpBase + $ftpFile
# WebClient nesnesi oluşturma
$webclient = New-Object System.Net.WebClient
$webclient.Credentials = New-Object System.Net.NetworkCredential($username, $password)
# Dosyayı yükleme
try {
$webclient.UploadFile($ftp, $localFile)
Write-Host “Dosya başarıyla yüklendi.”
} catch {
Write-Host “Dosya yüklenirken bir hata oluştu: $_”
} finally {
$webclient.Dispose()