This got me thinking about how to do the corresponding thing on Unix (find the hardware device). The following succeeds on my (Linux) machine, but may have problems with trailing slashes on the directories returned by 'mount'.
Ron Steinke rsteinke@w-link.net#!/usr/bin/perl use strict; use warnings; my $mountlist = `mount`; my %mounts; $mounts{$2} = $1 while($mountlist =~ /(.*) on (.*) type.*\n/g); my $location = `pwd`; chomp $location; my $mount_dir = $location; $mount_dir =~ s#/[^/]*$## while $mount_dir && !$mounts{$mount_dir}; $mount_dir ||= '/'; # Add the 'trailing' slash back in if we're mounte +d as root print "Directory $location is on device $mounts{$mount_dir}\n";
In reply to Re: check a drive litter
by rsteinke
in thread check a drive letter
by amoura
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |