autoline.py 764 B

1234567891011121314151617181920212223
  1. import plac
  2. from unlzw import unlzw
  3. from pathlib import Path
  4. @plac.pos('csv_dir', "", type=Path)
  5. def main(csv_dir):
  6. for zip_file in csv_dir.glob("*Z.*"):
  7. if zip_file.is_dir():
  8. continue
  9. #print(zip_file.stat())
  10. size = zip_file.stat().st_size
  11. if size > 100:
  12. new_file = str(zip_file)[:-8] + str(zip_file)[-1:] + ".csv"
  13. try:
  14. with open(zip_file, 'rb') as zip:
  15. with open(new_file, 'wb') as f_out:
  16. f_out.write(unlzw(zip.read()))
  17. except:
  18. print(str(zip_file) + ": " + str(size))
  19. if __name__ == '__main__':
  20. #plac.call(main)
  21. main(Path("C:\\GlobalCube\\System\\AUTOLINE\\Datenbank\\Full_zusammengesetllt"))