Skip to content

Instantly share code, notes, and snippets.

@leonkorteweg
Last active February 29, 2024 17:25
Show Gist options
  • Save leonkorteweg/459d7868a6038044a98b to your computer and use it in GitHub Desktop.
Save leonkorteweg/459d7868a6038044a98b to your computer and use it in GitHub Desktop.
Mirror a remote folder from the command line

Mirror a remote folder from the command line

Small but incredibly useful guide from wiak, posted on http://superuser.com/questions/40281/how-do-i-get-an-entire-directory-in-sftp

How to mirror a remote folder with lftp

well this little guide should help, mirror a remote server to local folder with lftp

lftp sftp://user:password@server.org:22 -e 'mirror --verbose --use-pget-n=8 -c /remote/path /local/path'
  • sftp:// = uses SFTP protocol
  • mirror = mirror mode
  • verbose = shows the files being downloaded
  • use-pget-n = number of segments, realy useful to speed up big files
  • parallel = downloads multiplier files at the same time

if you want to download files in parallel switch out use-pget-n=8 with --parallel=8

hope this helps anyone needing to mirror a remote folder to a local folder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment