0

I would like to run a Python script in my home directory that pulls data from various files. However, to access these files I need to log into an SSH and then navigate to a certain directory. Is there a way to do this while running my script in my home directory?

I would just copy them over using scp, but there are thousands, so I don't think this would be very efficient (but is a last resort option). Thanks!

1
  • scp has a 'recursive' flag, that would allow you copy an entire directory to your local machine. Commented Jul 26, 2018 at 23:27

2 Answers 2

1

I would recommend using rsync. This will ssh you in and perform r-sync on whatever directory you want. It's (probably) the most efficient and reliable way to pull a lot of large files.

rsync -a --progress username@remote_host:destination_directory ~/dir1
Sign up to request clarification or add additional context in comments.

Comments

1

You can try using sshfs. With it you can mount a file system in your local computer accessing it through your ssh connection.

sudo mkdir /mnt/droplet sudo sshfs -o allow_other,defer_permissions [email protected]:/ /mnt/droplet

Check this tutorial from digitalocean: https://www.digitalocean.com/community/tutorials/how-to-use-sshfs-to-mount-remote-file-systems-over-ssh

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.