There are various scenarios one may have to experience while playing with different web hosting and web management tasks. Especially at the time of migrations or transfer data from one server to another could be challenging if it is bigger in size an concluded with more of files and folders in numbers.
We are not discussing about databases here but only files and folders and in particular files/folders associated to a Linux based machine and in general for cPanel accounts. You can also know how to dump and restore big databases in CentOS/Linux cPanel Server
Zip a Folder or File in Linux
Let suppose you have a 50GB data stored in numerous folder under single main folder in a source machine and you have root access to server or shared user access with SSH ability then simply run below command in the shell to generate a zip file. Switch to particular folder like
Then run below command
zip –r mydirectory.zip source_directory_name
This will start a background process and take some while to generate zip file, once process will be finished, you will find a zip file as “mydirectory.zip” at path “/home/public_html/source_directory_name”
Unzip a Folder or File
Do the same as you did for source server, login to SSH, once after login, choose the path where you want to unzip, please keep in mind, if you will process this as a root but not a shared user shell, you may have to update correct user permissions after zipping so better go with a user shell where you are to restore those directories and files.
Let suppose we are to unzip files under a user account at path /home/public_html/target_directory_name
We will first switch to the folder and then run below command which will initiate a background process for unzipping files and folders, soon you will get them in shape.
That is it, keep in mind if you unzip as root user, you may have to further run below command to assign right permissions to the particular user.
Above command will only change the permissions and ownership of folder target_directory_name but nothing inside it, if you want to change the ownership of all folder and files with in target_directory_name, run as below.
chown /home/public_html/target_directory_name -R
Additional Resource a Free TIP
Copying folders/files from one to another folder Command
In certain cases, you may have to move or copy huge sized files from one folder to a different one, to do so through command line you may run
cp -r /home/user/public_html/destination_folder/Folder1 /home/user/public_html
This will copy Folder1 to at path /home/user/public_html/