#!/usr/bin/env perl # Last modified: Sat Jun 07 2025 01:57:01 PM -04:00 [EDT] use strict; use v5.18; use utf8; use warnings; use Win32::DriveInfo; =head1 NAME DriveFinder =head1 SYNOPSIS To be executed via a desktop shortcut. Command in shortcut: C:\perl\perl\bin\perl.exe "C:/Program Files/DriveFinder" =cut sub survey { my @rmvbl = grep { Win32::DriveInfo::DriveType($_) == 2 ? $_ : undef } Win32::DriveInfo::DrivesInUse(); for my $drv (@rmvbl) { my ( $VolumeName, $VolumeSerialNumber, $MaximumComponentLength, $FileSystemName, @attr ) = Win32::DriveInfo::VolumeInfo($drv); return $drv .":" if $VolumeName eq "FirstFS"; } return undef; } my $DriveVol = &survey; # Maybe chdir to C:\Users\somia\OneDrive\Pictures? - makes no difference. no warnings 'uninitialized'; while ( !exec($DriveVol.'/FS/FSViewer80/FSViewer.exe') ) { say qq[Plug the USB "Dragon" key drive into a USB slot],q[]; sleep 4; $DriveVol = &survey; } __END__ =pod =head1 Drive Types on Win32 0 - the drive type cannot be determined. 1 - the root directory does not exist. 2 - the drive can be removed from the drive (removable). 3 - the disk cannot be removed from the drive (fixed). 4 - the drive is a remote (network) drive. 5 - the drive is a CD-ROM drive. 6 - the drive is a RAM disk. =cut # vim: ft=perl et sw=4 ts=4 :