0

How can i list all and every directory on my PC .py

13th Oct 2021, 6:12 PM
Abdulmagid Algodimy
6 ответов
+ 2
Well python CA just browse a whole drive just use the glob utility import glob print (glob.glob(#drive-letter:/*/**/*.* recursive=true)
13th Oct 2021, 7:06 PM
🥇👩‍💻 Kintu Michael Evans 🔥🔥( Active)
🥇👩‍💻 Kintu Michael Evans 🔥🔥( Active) - avatar
+ 1
I mean, you kinda can...use the os library https://code.sololearn.com/calheDiLtdJE/?ref=app
13th Oct 2021, 7:01 PM
Slick
Slick - avatar
+ 1
Thank you
14th Oct 2021, 9:20 AM
Abdulmagid Algodimy
0
U possibly can't
13th Oct 2021, 6:56 PM
🥇👩‍💻 Kintu Michael Evans 🔥🔥( Active)
🥇👩‍💻 Kintu Michael Evans 🔥🔥( Active) - avatar
0
Thank you
13th Oct 2021, 7:18 PM
Abdulmagid Algodimy
0
Maybe this will help. Define a command line and send it to the operating system. #*NIX recursive dir command dircmd = "ls -RaF /" #MSDOS version #dircmd = "tree /F C:/" import os os.system(dircmd) If you want to work with the names in memory you could redirect the output to a file and load the file into memory. import os os.system(dircmd + " >dir.txt") f = open("dir.txt", "r") l = list(f) f.close() print(l)
14th Oct 2021, 9:15 AM
Brian
Brian - avatar