Skip to content

Commit

Permalink
add: update python data export json file
Browse files Browse the repository at this point in the history
  • Loading branch information
colourfulspring committed Feb 18, 2024
1 parent cb994d5 commit 3d686e0
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tensorboard_data_acquire.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import os
import shutil

# Source directory where files are located
source_dir = "./results"

# Destination directory where files will be copied
destination_dir = "./tensorboard_results"

# Find all files in the source directory starting with "events"
files = []
for root, dirs, filenames in os.walk(source_dir):
for filename in filenames:
if filename.startswith('events'):
files.append(os.path.join(root, filename))

# Loop through each file found
for file_path in files:
# Get the directory where the file is located relative to the source directory
relative_dir = os.path.relpath(os.path.dirname(file_path), source_dir)

# Create the corresponding directory structure in the destination directory
os.makedirs(os.path.join(destination_dir, relative_dir), exist_ok=True)

# Copy the file to the destination directory, preserving the directory structure
shutil.copy(file_path, os.path.join(destination_dir, relative_dir))

# Print out the copied files
print(f"Copied {file_path} to {os.path.join(destination_dir, relative_dir)}")

print("Copy operation completed.")

0 comments on commit 3d686e0

Please sign in to comment.