Replacing entire public.html folder

Zellephant

Expert Member
Joined
Aug 4, 2023
Messages
2,725
Reaction score
2,768
I need to restore a website that was hacked and completely broken.

I have the site backed up. But I’m having serious trouble uploading the content into the public.html folder via ftp. If I upload the entire website as a .zip file, it uploads reasonably quick, but once unzipped, it creates a new folder within the public.html folder, with the website content in. Then if I try copy it to the root of public.html via ftp, it takes hours, and eventually my ftp connection bombs out before it’s complete, and I sit with half a website transferred to the public folder.

I have tried renaming the folder with the backup of site as public, so I can upload it to root and then replace the existing public folder with the new one, but that also won’t work, because it’s as if I can’t delete the existing public.html folder, in file manager via KonsoleH or via FTP. It’s as if the xneelo have locked it somehow.

How do I upload the backup of the website into the root of the public folder? What am I missing?
 
You are creating a directory in the zip file likely by right clicking the local directory and starting a zip of that directory. Rather go into the local directory and select all the files and then create the zip. Then when you unzip in public.html it will be at the right depth.
 
You are creating a directory in the zip file likely by right clicking the local directory and starting a zip of that directory. Rather go into the local directory and select all the files and then create the zip. Then when you unzip in public.html it will be at the right depth.
I have tried that, but unfortunately it still doesn’t seem to work. When I unzip the archive on the server, it unzips into a folder with the same name as the zip archive. I can’t get it to unzip directly into the public_html “root” folder. I’m trying to copy the files individually via ftp again. Will leave it a few hours and see what happens. But the wp_content folder alone has like 11 0000 individual tiny files, so it’s going to take an age over ftp, and we just hope it doesn’t timeout again.

I’m using windows file explorers built in ftp capability though. Maybe I should be using a different ftp client.
 
No shell enabled on xneelo?
It doesn’t seem that way. I will call their tech support tomorrow to find out. Cant figure out from Konsoleh control panel if there is, or what the access details/username/password would be. I only find ftp login info.
 
It doesn’t seem that way. I will call their tech support tomorrow to find out. Cant figure out from Konsoleh control panel if there is, or what the access details/username/password would be. I only find ftp login info.
 
Could you not just upload the zip file, then use a PHP script to extract the content and then delete the scipt again afterwards ?

Quick ChatGPT generated this ,,,

<?php

$zipFile = __DIR__ . '/yourfile.zip'; // Change to your ZIP filename
$extractPath = __DIR__; // Root of the web server

if (!file_exists($zipFile)) {
die("ZIP file not found.");
}

$zip = new ZipArchive;

if ($zip->open($zipFile) === TRUE) {
$zip->extractTo($extractPath);
$zip->close();
echo "Extraction successful.";
} else {
echo "Failed to open ZIP file.";
}
 
Can't you just move the files within the web-based file manager?
 
Hetzner makes it a bit difficult do drag and drop filders - I have experienced the same issue before - wrote a php script similar to above to handle unzip and post-cleanup.
 
Top
Sign up to the MyBroadband newsletter
X