flzta commited on
Commit
e526d1d
·
verified ·
1 Parent(s): e3708bc

Update sync_data.sh

Browse files
Files changed (1) hide show
  1. sync_data.sh +5 -6
sync_data.sh CHANGED
@@ -78,16 +78,15 @@ try:
78
  if filepath and os.path.exists(filepath):
79
  print(f'Found latest backup: {latest_backup}, attempting to restore...')
80
  # 删除现有的数据目录
81
- if [ -d /opt/cloudreve/data ]; then
82
- echo "Deleting existing data directory: /opt/cloudreve/data"
83
- rm -rf /opt/cloudreve/data
84
- fi
85
  # 创建数据目录(如果被删除)
86
- mkdir -p /opt/cloudreve/data
87
 
88
  with tarfile.open(filepath, 'r:gz') as tar:
89
  tar.extractall('/opt/cloudreve/data')
90
- echo f'Successfully restored backup from {latest_backup}'
91
 
92
  except Exception as e:
93
  echo f'Error downloading backup from HuggingFace Dataset: {e}'
 
78
  if filepath and os.path.exists(filepath):
79
  print(f'Found latest backup: {latest_backup}, attempting to restore...')
80
  # 删除现有的数据目录
81
+ if os.path.isdir('/opt/cloudreve/data'):
82
+ print("Deleting existing data directory: /opt/cloudreve/data")
83
+ shutil.rmtree('/opt/cloudreve/data')
 
84
  # 创建数据目录(如果被删除)
85
+ os.makedirs('/opt/cloudreve/data', exist_ok=True)
86
 
87
  with tarfile.open(filepath, 'r:gz') as tar:
88
  tar.extractall('/opt/cloudreve/data')
89
+ print(f'Successfully restored backup from {latest_backup}')
90
 
91
  except Exception as e:
92
  echo f'Error downloading backup from HuggingFace Dataset: {e}'