Skip to content
TheChatArchiveThe Chat Archive
Qwenqwen3-235b-a22b-no-thinking· Alibaba (Qwen)Hugging Face LMArena Human Preference 140K

How can I copy a folder from one Ubuntu server to another Ubuntu server?

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Metallama-3.3-70b-instruct’s answer.
  1. User

    How can I copy a folder from one Ubuntu server to another Ubuntu server?

  2. Qwen Assistant

    To copy a folder from one Ubuntu server to another, you can use several methods depending on your needs and environment. Here are the most common and effective ways:


    ✅ 1. Using rsync over SSH (Recommended)

    rsync is fast, efficient, and supports resuming interrupted transfers.

    Syntax:

    rsync -avz -e ssh /path/to/local/folder username@remote_server:/path/to/remote/destination
    

    Example:

    rsync -avz -e ssh /var/www/html user@192.168.1.10:/backup/
    

    Explanation:

    • -a: Archive mode (preserves permissions, timestamps, etc.)
    • -v: Verbose output
    • -z: Compress during transfer
    • -e ssh: Use SSH for secure transfer

    ✅ 2. Using scp (Secure Copy)

    Good for simple transfers without advanced features like resume support.

    Syntax:

    scp -r /path/to/local/folder username@remote_server:/path/to/remote/destination
    

    Example:

    scp -r /home/user/myproject user@192.168.1.10:/home/user/
    
    • -r: Copy recursively (required for folders)

    ✅ 3. Using tar over SSH (for large directories)

    This method packs the directory on the source machine and unpacks it on the destination.

    From the destination server:

    ssh user@source_server "tar cvzf - /path/to/source/folder" | tar xvzf -
    

    Example:

    ssh user@192.168.1.5 "tar cvzf - /var/log" | tar xvzf -
    
    • This streams the folder compressed through SSH to the current directory.

    ✅ 4. Mount remote directory with sshfs and copy locally

    If you prefer working with local tools:

    Install sshfs:

    sudo apt install sshfs
    

    Mount remote folder:

    sshfs user@remote_server:/remote/path /mnt/local_mount_point
    

    Then copy using cp or file manager:

    cp -r /mnt/local_mount_point/folder /local/destination/
    

    ✅ 5. Using Network File Sharing (NFS or Samba)

    If both servers are on the same network, you can set up NFS or Samba share and directly access the remote folder as if it's local.

    • More complex to set up but useful for frequent transfers.

    🛡️ Tips:

    • Make sure SSH is installed and running on both servers.
    • If copying large files or directories, rsync is preferred because it can be resumed and is more efficient.
    • Always test with a small folder first.
    • For automation, consider setting up SSH key-based authentication.

    Let me know if you want help automating this or setting up SSH keys!

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.