From: Caleb Clausen Date: 2010-07-13T23:53:23+09:00 Subject: Re: Remote File Handling On 7/13/10, Brian Candler wrote: > Michael Maloney wrote: >> Is there a way to access files directly on remote servers the way you >> can in the local environment? Can I get into a remote server from my >> local machine and do things like File.ctime(my_remote_file) ? > > Short answer: no. > > Long answer: Ruby's Dir and File classes just sit on top of the > file/directory operations provided by the underlying operating system. > For example, Dir.pwd and Dir.chdir refer to the process's (local) > current working directory. > > However, on some systems, if you install the right tools, you may be > able to 'mount' a remote FTP or SFTP server as if it were a local > filesystem, and then you can traverse that. > > In Linux, "FUSE" allows people to write modules which do this. See > http://en.wikipedia.org/wiki/Filesystem_in_Userspace > and follow the links to FTPFS, SSHFS etc. > > Supplementary answer: it's also possible to abstract away local vs > remote file operations to some degree, see for example open-uri.rb in > the standard library. As far as I know, this hasn't been done to the > level you are seeking. But feel free to have a go at implementing it > yourself :-) You may find that you are stumped by the limited support > for ctime / chmod / chown etc by protocols like FTP. Or you can use a network file system such as nfs or samba, which makes remote files appear local to all programs on your computer.