本文整理汇总了Python中utilities.Utilities.archive_file方法的典型用法代码示例。如果您正苦于以下问题:Python Utilities.archive_file方法的具体用法?Python Utilities.archive_file怎么用?Python Utilities.archive_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utilities.Utilities
的用法示例。
在下文中一共展示了Utilities.archive_file方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: not
# 需要导入模块: from utilities import Utilities [as 别名]
# 或者: from utilities.Utilities import archive_file [as 别名]
archivedDir = os.path.join(mesAnoDir, mesDia)
if not (os.path.exists(archivedDir)):
os.makedirs(archivedDir)
else:
utils.log_output(logger, "{0} already exists.".format(archivedDir), 'info')
try:
# archivedFile = os.path.join(os.sep,archivedDir,fileName)
fileName = os.path.split(backupFile)[1]
archivedFile = os.path.join(archivedDir, fileName)
# Archive any existing file, appending the date/time
if os.path.exists(archivedFile):
utils.log_output(logger, "There is already a file named {0} in the {1} directory".format(fileName, archivedDir), 'error')
utils.log_output(logger, "Attempting to archive {0}...".format(archivedFile), 'info')
arr = utils.archive_file(archivedFile)
blnContinue = arr[0]
if blnContinue:
utils.log_output(logger, "{0} has been archived as {1}".format(archivedFile, arr[1]), 'debug')
if blnContinue:
os.rename(backupFile, archivedFile)
utils.log_output(logger, "{0} has been moved to {1}".format(backupFile, archivedFile), 'info')
if compress.lower() == 'true':
try:
return_value = utils.create_zipfile(archivedFile)
if return_value:
try:
os.remove(archivedFile)
utils.log_output(logger, "{0} has been removed.".format(archivedFile), 'info')
except: