Search code examples
pythoninputsshstreamglob

Is it possible to import files from another computer using glob in Python3.4?


I would like to use some .pkl files for this program I am creating. However the files are about 1.1 GB and there are a lot of them so I needed to store them on a larger space(which I do not have sudo permissions for). I would like to do something like this:

for file in glob.glob('/home/jdoe/data/serializedpiondata/'):
    '''Code''' ...
    ...
    ...

However the file are not located on my computer but rather a computer I have access to via SSH. Is it possible to perform a similar operation but grab the files from a directory on another computer?


Solution

  • You can do this by mounting the remote computer to the local filesystem using sshfs or something similar. At the OS level, you mount the remote system just like any other disk, and within Python, you would access it like you would any other local file. Since all traffic goes over ssh (and the internet?) assume some lag of course.