-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdiskwalk.py
More file actions
35 lines (24 loc) · 862 Bytes
/
Copy pathdiskwalk.py
File metadata and controls
35 lines (24 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python
import os
class diskwalk():
def __init__(self,path):
self.path = path
def enumeratePaths(self):
path_collection = []
for dirpath,dirs,filenames in os.walk(self.path):
for filename in filenames:
fullpath = os.path.join(dirpath,filename)
path_collection.append(fullpath)
return path_collection
def enumerateDirs(self):
dir_collection = []
for dirpath,dirs,filenames in os.walk(self.path):
for dir in dirs:
dir_collection.append(dir)
return dir_collection
def enumeratefiles(self):
file_collection = []
for dirpath,dirs,filenames in os.walk(self.path):
for filename in filenames:
file_collection.append(filename)
return file_collection