0

I'm looking for a way to get to the CWD's drive root no matter what the drive's volume letter is.

For example... say the program is on a drive (HDD's, SSD's, VHD's, etc.), I want to be able to go to the current drive's root. So basically, I want to change my CWD to the drive root no matter what the volume letter is.

I know that this says "Show what you've tried". The thing is, I'm not sure where to begin.

Dragonthoughts
  • 2,180
  • 8
  • 25
  • 28
  • Ever heard of the `/` (Root) slash. Following this answer here https://stackoverflow.com/a/431715/9741277 should get you started. – leun4m Sep 18 '20 at 14:19

1 Answers1

0
import os
dir_path = os.path.dirname(os.path.abspath(__file__))

Hope I'm up to date with python, but is mandatory that you use os lib. Then you can easily filter with regex.

Sheidx
  • 28
  • 4