-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add: update python data export json file
- Loading branch information
1 parent
cb994d5
commit 3d686e0
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.") |