19 lines
443 B
Python
19 lines
443 B
Python
from os import walk
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
def listeDossier(path = None):
|
|
if path == None:
|
|
path = Path().absolute()
|
|
else:
|
|
path = Path(path)
|
|
|
|
_, _, filenames = next(walk(path))
|
|
|
|
with open(path.parent.absolute() / "resultat.txt", 'w') as f:
|
|
f.write('\n'.join(filenames))
|
|
|
|
return "Done!"
|
|
|
|
if __name__ == "__main__":
|
|
print(listeDossier(sys.argv[1] if len(sys.argv) > 1 else None))
|