copying files using SSH

Discussion in 'Site & Server Administration' started by tyler3, Jan 10, 2008.

  1. #1
    I'm trying to copy files via SSH from one website to another (I use cpanel) using the following command once I'm logged in:

    cp /home/user/public_html/*.* /home/user/public_html


    (of course replacing 'user' with the actual user name)

    This only copies the files that are in public_html, not the folders.What command do I use to copy all files AND folders via SSH?

    Also, I'm using putty, and it prompts me to overwrite files that already exist (for each file, which can be kind of annoying). Is there a way to write the command so it overwrites what is already there?
     
    tyler3, Jan 10, 2008 IP
  2. linsys

    linsys Peon

    Messages:
    274
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Actually you are not doing this via SSH you are doing this VIA the shell, just an FYI..

    To copy the directories you need to use the -r option so like this

    cp -r /home/user/public_html/*.* /home/user/public_html/

    If you are being promoted for the overwrite then that means that the server administrator has setup cp as a command alias, simply type

    unalias cp

    before you use your cp command.
     
    linsys, Jan 10, 2008 IP
  3. 007c

    007c Peon

    Messages:
    611
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Don't forget the h option unless you feel like chowning and chmodding them all...
     
    007c, Jan 10, 2008 IP
  4. energetic

    energetic Well-Known Member

    Messages:
    2,844
    Likes Received:
    55
    Best Answers:
    0
    Trophy Points:
    165
    #4
    how to copy it from server to server ?
     
    energetic, Jan 10, 2008 IP
  5. sreyas

    sreyas Well-Known Member

    Messages:
    128
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    108
    #5
    Use scp for copying from server to server

    scp -r /home/user/public_html/*.* user@desserverip:/home/user/public_html/

    this will prompt you for password , enter it and there you go
     
    sreyas, Jan 10, 2008 IP
  6. tyler3

    tyler3 Peon

    Messages:
    270
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I don't suppose you can use 'shell' to copy DBs can you? :) That would complete everything for me almost haha.
     
    tyler3, Jan 10, 2008 IP
  7. inworx

    inworx Peon

    Messages:
    4,860
    Likes Received:
    201
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Databases aren't stored in .sql or such fixed format. Simply dump a backup, and transfer.
     
    inworx, Jan 11, 2008 IP