File tree 1 file changed +9
-0
lines changed
1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,9 @@ def list_files(top_path, log=None):
140
140
results = []
141
141
142
142
for root , dirs , files in os .walk (top_path , followlinks = True ):
143
+ # Sort directories and files to ensure they are always processed in the same order
144
+ dirs .sort ()
145
+ files .sort ()
143
146
for file_name in files :
144
147
file_path = os .path .join (root , file_name )
145
148
relative_path = os .path .relpath (file_path , top_path )
@@ -211,6 +214,9 @@ def yesno_bool(val):
211
214
212
215
def emit_dir_content (base_dir ):
213
216
for root , dirs , files in os .walk (base_dir , followlinks = True ):
217
+ # Sort directories and files to ensure they are always processed in the same order
218
+ dirs .sort ()
219
+ files .sort ()
214
220
if root != base_dir :
215
221
yield os .path .normpath (root )
216
222
for name in files :
@@ -596,6 +602,9 @@ def emit_file(fpath, opath):
596
602
yield path
597
603
else :
598
604
for root , dirs , files in os .walk (path , followlinks = True ):
605
+ # Sort directories and files to ensure they are always processed in the same order
606
+ dirs .sort ()
607
+ files .sort ()
599
608
o , d = norm_path (path , root )
600
609
# log.info('od: %s %s', o, d)
601
610
if root != path :
You can’t perform that action at this time.
0 commit comments