copy dir to remote server with ssh, tar and gzip

    0

    0

    Daniele Cariboni

    The first code will copy all the files from your local 'localfolder' to the remote 'target' directory. Symlink will not be included.

    The second code will copy the symlink form your local 'localfolder' to the remote 'target' directory. Symlink will be copied as regular files

    tar zcvf - ./localfolder/ | ssh remoteserver "tar xzf - -C /path/to/target"
    
    
    #to copy symlink as files
    tar zcvfh - ./localfolder/ | ssh remoteserver "tar xzf - -C /path/to/target"
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.