rename_segment_semantic.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import argparse
  2. import os
  3. import shutil
  4. folders = [
  5. "allensville",
  6. "beechwood",
  7. "benevolence",
  8. "coffeen",
  9. "collierville",
  10. "corozal",
  11. "cosmos",
  12. "darden",
  13. "forkland",
  14. "hanson",
  15. "hiteman",
  16. "ihlen",
  17. "klickitat",
  18. "lakeville",
  19. "leonardo",
  20. "lindenwood",
  21. "markleeville",
  22. "marstons",
  23. "mcdade",
  24. "merom",
  25. "mifflinburg",
  26. "muleshoe",
  27. "newfields",
  28. "noxapater",
  29. "onaga",
  30. "pinesdale",
  31. "pomaria",
  32. "ranchester",
  33. "shelbyville",
  34. "stockman",
  35. "tolstoy",
  36. "uvalda",
  37. ]
  38. TASKS = {
  39. 's': 'segment_semantic',
  40. }
  41. def parse_tasks(task_str):
  42. tasks = []
  43. for char in task_str:
  44. tasks.append(TASKS[char])
  45. return tasks
  46. def run():
  47. parser = argparse.ArgumentParser(description='Extract')
  48. parser.add_argument("--dir", type=str)
  49. args = parser.parse_args()
  50. for f in folders:
  51. p = os.path.join(args.dir, "segment_semantic", f)
  52. files = os.listdir(p)
  53. for file in files:
  54. if "segmentsemantic" in file:
  55. old_file = os.path.join(p, file)
  56. new_file = old_file.replace("segmentsemantic", "segment_semantic")
  57. shutil.move(old_file, new_file)
  58. if __name__ == '__main__':
  59. run()