Search code examples
perlshellfilesystemsnfs

How can I tell if a file is on a remote filesystem with Perl?


Is there a quick-and-dirty way to tell programmatically, in shell script or in Perl, whether a path is located on a remote filesystem (nfs or the like) or a local one? Or is the only way to do this to parse /etc/fstab and check the filesystem type?


Solution

  • stat -f -c %T <filename> should do what you want. You might also want -l