File tree 1 file changed +14
-0
lines changed
1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 37
37
38
38
copied_count = 0
39
39
40
+ def clear_destination (folder ):
41
+ for filename in os .listdir (folder ):
42
+ file_path = os .path .join (folder , filename )
43
+ try :
44
+ if os .path .isfile (file_path ) or os .path .islink (file_path ):
45
+ os .unlink (file_path )
46
+ elif os .path .isdir (file_path ):
47
+ shutil .rmtree (file_path )
48
+ except Exception as e :
49
+ print ('Failed to delete %s. Reason: %s' % (file_path , e ))
50
+
40
51
def cp (from_path , to_path ):
41
52
if not os .path .isfile (from_path ): return
42
53
os .makedirs (os .path .dirname (to_path ), exist_ok = True )
@@ -65,7 +76,10 @@ def copy_paths(paths):
65
76
66
77
if result .returncode == 0 :
67
78
paths = result .stdout .splitlines ()
79
+
80
+ clear_destination (CONFIGS ['DESTINATION_PATH' ])
68
81
copy_paths (paths )
82
+
69
83
if copied_count == 0 :
70
84
print ('No changes in ' , CONFIGS ['LOCAL_PREXFIX' ])
71
85
else :
You can’t perform that action at this time.
0 commit comments