File tree 2 files changed +25
-5
lines changed
2 files changed +25
-5
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,14 @@ def main():
131
131
action = argparse .BooleanOptionalAction ,
132
132
help = "output per-user geezer files list." ,
133
133
)
134
+ parser .add_argument (
135
+ "-q" ,
136
+ "--quite" ,
137
+ dest = "quite" ,
138
+ required = False ,
139
+ action = argparse .BooleanOptionalAction ,
140
+ help = "Do not show progress" ,
141
+ )
134
142
parser .add_argument (
135
143
"-a" ,
136
144
"--geezerage" ,
@@ -154,16 +162,16 @@ def main():
154
162
global args
155
163
args = parser .parse_args ()
156
164
165
+ tqdm_disable = False
166
+ if args .quite : tqdm_disable = True
167
+
157
168
global sed
158
169
sed = dict ()
159
170
for s in args .se .split ("," ):
160
171
sed [s ] = 1
161
172
162
173
folder = args .folder
163
- p = Path (folder )
164
- files = [p ]
165
- files2 = p .glob ("**/*" )
166
- files .extend (files2 )
174
+ p = Path (folder ).absolute ()
167
175
168
176
broken_links = dict ()
169
177
geezers = dict ()
@@ -174,7 +182,7 @@ def main():
174
182
outfh = sys .stdout
175
183
176
184
with Pool (processes = args .threads ) as pool :
177
- for fd in tqdm .tqdm (pool .imap_unordered (task , files ), total = len ( files ) ):
185
+ for fd in tqdm .tqdm (pool .imap_unordered (task , scantree ( p )), disable = tqdm_disable ):
178
186
uid = fd .get_userid ()
179
187
if fd .get_type () == "L" : # broken link
180
188
if not uid in broken_links : broken_links [uid ] = list ()
Original file line number Diff line number Diff line change 5
5
import sys
6
6
import time
7
7
8
+ def scantree (path ):
9
+ # requires global dirs
10
+ """Recursively yield DirEntry objects for given directory."""
11
+ for entry in os .scandir (path ):
12
+ try :
13
+ if entry .is_dir (follow_symlinks = False ):
14
+ dirs .append (entry .path )
15
+ yield from scantree (entry .path )
16
+ else :
17
+ yield entry .path
18
+ except :
19
+ return
8
20
9
21
def which (program ):
10
22
def is_exe (fpath ):
You can’t perform that action at this time.
0 commit comments