提交 b28a56c4 编写于 作者: F FondMemoryVVV

fix tar_files.py

Signed-off-by: NFondMemoryVVV <mashuai53@huawei.com>
上级 4e70fd5d
......@@ -23,21 +23,21 @@ import shutil
copy_file_counts = 0
def copy_files(sourcedir, targetDir):
def copy_files(sourcedir, targetdir):
global copy_file_counts
for f in os.listdir(sourcedir):
source_f = os.path.join(sourcedir, f)
target_f = os.path.join(targetDir, f)
target_f = os.path.join(targetdir, f)
if not os.path.isfile(source_f):
if os.path.isdir(source_f):
copy_files(source_f, target_f)
elif os.path.isfile(source_f):
if os.path.exists(targetDir):
continue
if os.path.exists(targetdir):
copy_file_counts += 1
with open(target_f, "wb") as fp:
fp.write(open(source_f, "rb").read())
elif not os.path.exists(targetDir):
os.makedirs(targetDir)
elif not os.path.exists(targetdir):
os.makedirs(targetdir)
copy_file_counts += 1
with open(target_f, "wb") as fp:
fp.write(open(source_f, "rb").read())
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册