The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to Zip, Move, Unzip Public_Html

Discussion in 'Data Protection' started by CPanelGuy, May 21, 2008.

  1. CPanelGuy

    CPanelGuy Registered

    Joined:
    Jul 21, 2003
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    I'm trying to move all files in the public_html folder from one server to the other. The way I used to do it was download all the files to my computer, then upload them again to the new server. This is a hassle and time consuming, obviously.

    My question is, what is the SSH command to do the following:

    - Zip the public_html folder

    - Move or Copy zipped file from server #1 to server #2

    - Unzip it the public_html folder

    I figure this is the easiest way to do what I'm trying to do, unless you know of a better and faster way. Any help would be greatly appreciated.
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,453
    Likes Received:
    195
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
  3. tlovrec

    tlovrec Member

    Joined:
    Apr 11, 2008
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    1
    I believe cPanel does have the backup option of only public_html, so you download the public_html backup from cPanel interface, and upload it on another server.

    To do command line movement's first you'll need shell access to both server, and then you could, tar it, like:
    tar cvf public_html.tar public_html/
    Gun or BunZip it:
    gzip -9 public_html.tar/bzip2 -9 public_html.tar
    Copy the public_html.tar.gz/public_html.tar.bz2 to your public_html
    Go to the other server, download it there with wget http://your-old-servers-domain.com/public_html.tar.gz
    or
    http://your-old-servers-domain.com/public_html.tar.bz2

    And untar it again:
    tar xvf public_html.tar.gz/public_html.tar.bz2
     
  4. DaveUsedToWorkHere

    DaveUsedToWorkHere Well-Known Member

    Joined:
    Dec 28, 2001
    Messages:
    689
    Likes Received:
    1
    Trophy Points:
    18

    Do you want to transfer the entire cPanel account, or just public_html?

    If you want to transfer the entire account, the server administrator can use the transfers function in WHM.

    If you wish to delete the public_html directory on server2 and replace it with the public_html from server 1:

    WARNING: This will overwrite public_html on server2. DO NOT DO THIS WITHOUT BACKUPS OF PUBLIC_HTML FROM SERVER2

    Code:
    tar -cvf public_html.tar public_html
    scp public_html.tar username@server2:~/
    ssh username@server2
    rm -rf public_html
    tar -xvf public_html.tar
    
     
Loading...

Share This Page