Нема описа
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.

123456789101112131415161718192021222324252627282930313233343536373839
  1. ################################## Selection first file from all folder #######################
  2. import os
  3. import shutil
  4. import click
  5. @click.command()
  6. @click.argument('eventid', default='')
  7. def unq1(eventid):
  8. p1 = r"C:\\Users\\Administrator\\Documents\\AI\\runtimecropimages\\sepration_cluster\\" + eventid + "\\"
  9. p2 = r"C:\\Users\\Administrator\\Documents\\AI\\runtimecropimages\\unique_1\\" + eventid + "\\"
  10. for path, folders, files in os.walk(p1):
  11. if not files: continue
  12. try:
  13. src = os.path.join(path, files[0])
  14. except IndexError:
  15. pass
  16. dst_path = path.replace(p1, '') + os.sep
  17. # dst_folder = p2 + dst_path
  18. # create the target dir if doesn't exist
  19. # if not os.path.exists(dst_folder):
  20. # os.makedirs(dst_folder)
  21. # create dst file with only the first file
  22. try:
  23. dst = p2 + files[0]
  24. except IndexError:
  25. pass
  26. # copy the file
  27. shutil.copy2(src, dst)
  28. unq1()