On 2020-05-17 00:52, ToddAndMargo via perl6-users wrote:
Hi All,

Windows 7 & 10

I want to know if a drive letter exists:


K:\Windows\NtUtil>df -kPT
Filesystem           Type  1024-blocks      Used Available Capacity Mounted on
C:/Program Files/Git ntfs     40585620  15044068  25541552      38% /
D:                   udf       5294394   5294394         0     100% /d
E:                   ntfs         8188      3908      4280      48% /e
F:                   ntfs        10236      3908      6328      39% /f
J:                   smbfs   951048868 514547660 436501208      55% /j
K:                   smbfs   951048868 514547680 436501188      55% /k
L:                   smbfs   951048868 514547700 436501168      55% /l

K:\Windows\NtUtil>dir e:
  Volume in drive E is DRIVERS
  Volume Serial Number is 44EB-5181

  Directory of E:\

File Not Found

This exists:
K:\Windows\NtUtil>raku -e "say 'H:'.IO.d.Bool;"
True

This does not:
K:\Windows\NtUtil>raku -e "say 'Z:'.IO.d.Bool;"
True


Many thanks,
-T



Follow up:

Hi All,

Prince213 on the chat line helped me figure this out.

This is from my IO keeper:

Drive (letter) exists (Windows only):
   use `IO.e.Bool`

   # forward slashes
   >raku -e "say 'X:/'.IO.e.Bool;"
   False

   >raku -e "say 'D:/'.IO.e.Bool;"
   True

   >raku -e "say 'd:/'.IO.e.Bool;"
   True

   >raku -e "say 'Z:/'.IO.e.Bool;"
   False

   # back slashes
   >raku -e "say 'd:\\'.IO.e.Bool;"
   True

   >raku -e "say Q[d:\].IO.e.Bool;"
   True

   >raku -e "say Q[z:\].IO.e.Bool;"
   False


-T

Reply via email to