1. import os
  2. import shutil
  3. def initialize_internal_tooling(base_dir):
  4. """Initializes the necessary directories for internal tooling."""
  5. # Define the directories to create
  6. directories = [
  7. "data",
  8. "models",
  9. "scripts",
  10. "docs",
  11. "tests"
  12. ]
  13. # Create the directories if they don't exist
  14. for dir_name in directories:
  15. dir_path = os.path.join(base_dir, dir_name)
  16. if not os.path.exists(dir_path):
  17. os.makedirs(dir_path)
  18. print(f"Created directory: {dir_path}")
  19. else:
  20. print(f"Directory already exists: {dir_path}")
  21. # Create a sample file in each directory for basic structure
  22. for dir_name in directories:
  23. sample_file = os.path.join(base_dir, dir_name, "sample_file.txt")
  24. if not os.path.exists(sample_file):
  25. with open(sample_file, "w") as f:
  26. f.write("This is a sample file.")
  27. print(f"Created sample file: {sample_file}")
  28. else:
  29. print(f"Sample file already exists: {sample_file}")
  30. if __name__ == "__main__":
  31. # Example usage:
  32. base_directory = "internal_tooling"
  33. if not os.path.exists(base_directory):
  34. os.makedirs(base_directory)
  35. initialize_internal_tooling(base_directory)

Add your comment