> How do I check to see if a drive (i.e. C: or D:) exists??
> 
> I am writing a script to couple start menu files to the
> all users directory of different windows configurations
> and I need to know this to edit the shortcuts on some
> machines (forget about why).  Any help would be greatly
> appreciated.

That information is *probably* stored in the registery
someplace, and for a near 100% reliable approach I'd go
there for it.

---

I coded this, however a certain OS monopoly decided that
the output of the fdisk command should go straight to the
terminal - bypassing any notion of STDOUT.  Grr...

#!/usr/bin/perl -w

use strict;

# Fetch information from my fancy function
my %partitions = partitions();

# Display what we DIDN'T find :( 
foreach (keys %partitions) {
  print "$_ has size $partitions{$_}\n";
}

# Find partitions and sizes
sub partitions {
  my %partitions;

  # Pattern used to extract information
  my $pattern = qr/^               # Anchor to line
beginning,
                   \s*             # and be happy with some
space
                       (
                        [A-Z]      # Grab the drive letter
                       )
                   :               # Make sure it has the
colon,
                   \s+             # and some space after
it too
                       (
                        \d+        # The partition size in
Mb
                       )
                  /x;              # Allow the heavy
overcommenting

  # Get information from fdisk, and iterate over lines
  foreach (qx(fdisk /status)) {
      $partitions{$1} = $2 if (/$pattern/o);
  }

  # Return what we have just gleaned
  return %partitions;
}

---

One way around this is to use fdisk, take a screen capture
and then do a bit for bit search for the characters on your
screen... rather like a screen only version of OCR!

Anyone else got a better brainwave?

Jonathan Paton

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to