in reply to Re: How to Determine If A File Is On NFS? Local? Etc?
in thread How to Determine If A File Is On NFS? Local? Etc?

Looking at the first element returned by stat() doesn't seem to work. I tried:
my $nfs_file = '/auto/somewhere/testfile.txt'; my $local_file = '/tmp/testfile.txt'; my @stat_stuff = stat("$nfs_file"); print "Device for nfs file is $stuff[0]."; @stat_stuff = stat("$local_file"); print "Device for local file is $stuff[0].\n";
When I ran it, I got 14 for the NFS mounted file and 10 for the local file. Both greater than 0. Have I misunderstood something?

Replies are listed 'Best First'.
Re^3: How to Determine If A File Is On NFS? Local? Etc?
by jaco (Pilgrim) on Sep 21, 2004 at 13:47 UTC
    This method depends on the way devices are numbered in your
    OS. All it means is that you're using an OS which does
    not list NFS as a negative device number.

    No big deal, just adapt the code to fit.
      Hmmm....rats, I was hoping for a method that would be more portable between systems. Any other ideas?
Re^3: How to Determine If A File Is On NFS? Local? Etc?
by valentin (Abbot) on Sep 21, 2004 at 13:47 UTC
    Hmm, no that was what borisz wrote. /me goes to read perldoc -f stat.