Commit 4a1a7870 authored by Carina Lansing's avatar Carina Lansing
Browse files

Fixing the link script.

parent 3b11675b
......@@ -15,7 +15,6 @@ def create_sym_link(source_file, linked_file):
os.remove(linked_file)
# Make a symbolic link
print("Creating symbolic link: " + linked_file)
os.symlink(source_file, linked_file)
......@@ -28,11 +27,20 @@ def main():
outputs_dir = os.path.join(run_dir, "data/outputs")
data_dir = os.path.join(run_dir, "notebooks/DATA")
for root, dirs, files in os.walk(outputs_dir):
for parent_folder, dirs, files in os.walk(outputs_dir):
for name in files:
print(os.path.join(root, name))
for name in dirs:
print(os.path.join(root, name))
# Ignore the model raw files and log files
if 'sgpwrf' not in parent_folder and name.endswith('.nc'):
folder_name = os.path.dirname(parent_folder)
dest_folder = os.path.join(data_dir, folder_name)
linked_file = os.path.join(dest_folder, name)
source_file = os.path.join(parent_folder, name)
# Make sure the destination folder exists
if not os.path.isdir(dest_folder):
os.mkdir(dest_folder)
create_sym_link(source_file, linked_file)
if __name__ == "__main__":
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment