I want to search my entire computer for a specific file. However os.walk requires a directory path as argument. How can I make it so that the search always starts from the root. One thing I can do is specify drive letter in windows. However I am looking for a better alternative that can work on windows, linux and mac. Thanks in advance.
Asked
Active
Viewed 16 times
0
-
1At a command line, how would you list the root directory? You would do `"dir \"` on Windows, or `ls /` on Linux. The root is just `"/"`. On Windows, that will be the root of whatever the current drive is; you can't get away from that in an os-independent way. – Tim Roberts Oct 19 '22 at 18:59