What I'd like to do is detect all of the top-level directories (i.e. C:\
, A:\
, X:\
, et cetera) on Windows in light of the fact that This PC
is seemingly inaccessible.
The following code works, but is obviously not ideal and has many drawbacks. For instance, I don't believe the namespace is even limited to A
to Z
, which would create major problems with such an approach.
const
fs = require('fs'),
ab = 'abcdefghijklmnopqrstuvwxyz'.split('')
ab.forEach(v => fs.existsSync(`${v}:\\`))
Is anybody aware of any other way to do this?