Answer the question
In order to leave comments, you need to log in
Console folder upload to hosting, what do you recommend?
Hello! You need to upload a folder with subfolders and files to the hosting.
While reading the forums, I realized that it is better not to use the standard ftp command.
If not difficult, show an example.
And I haven’t figured out this point yet: if you need to save a folder from a PC to a hosting in the right directory, how to prescribe it? in filezilla it looks like this /sitw.ru/htdocs/1/
Answer the question
In order to leave comments, you need to log in
My PowerShell script:
"Работа начата: "
Get-Date
$localdir = "PATH"
$ftp = "ftp://site.ru/"
$user = "user"
$pass = "pass"
$webclient = New-Object System.Net.WebClient
$webclient.Credentials = New-Object System.Net.NetworkCredential($user,$pass)
$items = Get-ChildItem -Path $localdir -Recurse | where {тут можно сунуть регэксп or so}
$max = $items.Count;
$i=1;
$max = $items.Count;
foreach($item in $items) {
"Uploading $item..."
$uri = New-Object System.Uri($ftp+$item.Name)
$webclient.UploadFile($uri, $item.FullName)
"Файл $i из $max передан на FTP-сервер"
$i++;
}
"Работа завершена: "
Get-Date
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question