From fda81cba1aaffb75dbe14e5c4414a5c5ddc15a53 Mon Sep 17 00:00:00 2001 From: Jesus Pulido Date: Mon, 6 May 2024 16:46:32 -0600 Subject: [PATCH] directory fix and version upgrade --- dsi/_version.py | 2 +- dsi/core.py | 8 ++++++++ examples/datasync/datacopy.py | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/dsi/_version.py b/dsi/_version.py index ecf384a..f5fe964 100644 --- a/dsi/_version.py +++ b/dsi/_version.py @@ -1 +1 @@ -__version__ = "0.5" \ No newline at end of file +__version__ = "1.0" \ No newline at end of file diff --git a/dsi/core.py b/dsi/core.py index 6ea5d65..9c131c2 100644 --- a/dsi/core.py +++ b/dsi/core.py @@ -4,6 +4,7 @@ from itertools import product import os import shutil +from pathlib import Path from dsi.backends.filesystem import Filesystem from dsi.backends.sqlite import Sqlite, DataType, Artifact @@ -346,6 +347,13 @@ def copy(self, local_loc, remote_loc, isVerbose=False): # Data movement # Future: have movement service handle type (cp,scp,ftp,rsync,etc.) for file,file_remote in zip(file_list,rfile_list): + abspath = os.path.dirname(os.path.abspath(file_remote)) + if not os.path.exists(abspath): + if isVerbose: + print( " mkdir " + abspath) + path = Path(abspath) + path.mkdir(parents=True) + if isVerbose: print( " cp " + file + " " + file_remote) shutil.copyfile(file , file_remote) diff --git a/examples/datasync/datacopy.py b/examples/datasync/datacopy.py index 9d8cee4..db348b0 100644 --- a/examples/datasync/datacopy.py +++ b/examples/datasync/datacopy.py @@ -1,9 +1,9 @@ from dsi.core import Sync #Origin -local_files = "H:/Data/shaped2d/" +local_files = "H:/Data/Scratch/shaped2d/" #Remote -remote_path = "C:/tmp/" +remote_path = "H:/tmp/" # Create Sync type with project name s = Sync("shape2d")