osanseviero commited on
Commit
9c92c74
·
1 Parent(s): e6786d3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -8
app.py CHANGED
@@ -39,14 +39,12 @@ def duplicate(source_repo, dst_repo, token, repo_type):
39
  for f in files:
40
  if not f.startswith("."):
41
  if ".git" not in root:
42
- directories_list = root.split("/")
43
- path_in_repo = "/".join(directories_list[3:]) # remove hub/namespace/reponame
44
- print(directories_list, local_dir, path_in_repo, f)
45
- if path_in_repo:
46
- print("Download with path", path_in_repo)
47
- upload_file(path_or_fileobj=os.path.join(local_dir, path_in_repo, f),repo_id=dst_repo, token=token, repo_type=repo_type, path_in_repo=path_in_repo)
48
- else:
49
- upload_file(path_or_fileobj=os.path.join(local_dir, path_in_repo, f), repo_id=dst_repo, token=token, repo_type=repo_type)
50
 
51
 
52
  # Clean up to be nice with the environment
 
39
  for f in files:
40
  if not f.startswith("."):
41
  if ".git" not in root:
42
+ # remove hub/namespace/reponame
43
+ local_file_path = os.path.join(local_dir, path_in_repo, f)
44
+ directory_path_in_repo = "/".join(root.split("/")[3:])
45
+ path_in_repo = os.join(directory_path_in_repo, f)
46
+ print("Download with path", path_in_repo)
47
+ upload_file(path_or_fileobj=local_file_path,repo_id=dst_repo, token=token, repo_type=repo_type, path_in_repo=path_in_repo)
 
 
48
 
49
 
50
  # Clean up to be nice with the environment