G
G
genesis11112019-09-24 17:16:37
cmd/bat
genesis1111, 2019-09-24 17:16:37

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

2 answer(s)
R
Ronald McDonald, 2019-09-24
@genezis1111

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

Have questions? Ask.

S
Saboteur, 2019-09-24
@saboteur_kiev

configure ssh keys and copy via scp
scp for Windows can be taken in different places. You can even look for rsync

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question