You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
694 B
24 lines
694 B
#!/usr/bin/python3 |
|
|
|
import os |
|
import sys |
|
|
|
def find_c_h_files(dirs): |
|
files = [] |
|
for d in dirs: |
|
for root, _, filenames in os.walk(d): |
|
for fname in filenames: |
|
if fname.endswith('.c') or fname.endswith('.h'): |
|
files.append(os.path.join(root, fname)) |
|
return sorted(files) |
|
|
|
if __name__ == "__main__": |
|
if len(sys.argv) < 2: |
|
print("Usage: python gen_filelist.py <dir1> [dir2] ...") |
|
sys.exit(1) |
|
dirs = sys.argv[1:] |
|
files = find_c_h_files(dirs) |
|
with open('filelist.txt', 'w') as f: |
|
for file in files: |
|
f.write(file + '\n') |
|
print(f"Generated filelist.txt with {len(files)} files.")
|
|
|