本文整理汇总了Python中FileUtils.deleteFile方法的典型用法代码示例。如果您正苦于以下问题:Python FileUtils.deleteFile方法的具体用法?Python FileUtils.deleteFile怎么用?Python FileUtils.deleteFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileUtils
的用法示例。
在下文中一共展示了FileUtils.deleteFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _updateJobData
# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import deleteFile [as 别名]
def _updateJobData(self, uiDict):
paths = uiDict.get("paths", [])
jobId = uiDict.get("jobId", None)
path = pack("{}.tar".format(jobId), *paths)
if path:
self.logger.debug("Sending File... {} ".format(path))
returnValue = self.network.sendCommand("requestFileUpload", jobId=jobId)
if not returnValue:
return
remotePath = returnValue.get("path", None)
if remotePath:
path = pack("{}.tar".format(jobId), *paths)
self.logger.info("Sending Files... ")
if path:
self.network.sendFileSFTP(path, remotePath, callback=None)
FileUtils.deleteFile(path)
self.network.sendCommand("fileUploadCompleted", waitForResponse=True, path=remotePath, jobId=jobId)
return True
else:
return False
return False
示例2: copyFiles
# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import deleteFile [as 别名]
def copyFiles(configData):
if False == configData.has_key(s_copyFileKey):
ColorPrint.errorPrint("没有定义复制文件")
return
copyFilesConfig = configData[s_copyFileKey]
for _, value in enumerate(copyFilesConfig):
targetFolder = getFileTargetFolder(value)
source = value[s_sourceKey]
isNew = isNewFromConfig(value)
isFilter = isFilterFormConfig(value)
if s_jsonTrue == isFilter:
continue
if not os.path.exists(g_projectPath + targetFolder):
FileUtils.newFolder(g_projectPath + targetFolder)
if s_jsonTrue == isNew:
FileUtils.deleteFile(g_projectPath + targetFolder + source)
FileUtils.copyFile(s_sourcePath + source , g_projectPath + targetFolder + source)
ColorPrint.colorPrint("Copy " + s_sourcePath + source)
elif not os.path.isfile(g_projectPath + targetFolder + source):
FileUtils.copyFile(s_sourcePath + source , g_projectPath + targetFolder + source)
ColorPrint.colorPrint("Copy " + s_sourcePath + source)
示例3: _addJob
# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import deleteFile [as 别名]
def _addJob(self, uiDict):
'''
@summary: Adds a job with a template
@param userId: the userId
@param template: the path to the template or a template
@result:
'''
uiDict["userId"] = self.userId
if uiDict.get("template", None):
jobDict = TemplateParser.ParseTemplate(uiDict.get("template", None))
uiDict.update(jobDict)
del uiDict["template"]
paths = uiDict.get("paths", [])
if "paths" in uiDict:
del uiDict["paths"]
self.logger.debug(paths)
returnValue = self.network.sendCommand("addJob", **uiDict)
if returnValue.get("result", False):
jobId = returnValue.get("jobId", None)
if not jobId:
return False
returnValue = self.network.sendCommand("requestFileUpload", jobId=jobId)
if not returnValue:
return
remotePath = returnValue.get("path", None)
if remotePath:
try:
path = pack("{}.tar".format(jobId), *paths)
if path:
self.network.sendFileSFTP(path, remotePath, callback=None)
FileUtils.deleteFile(path)
self.network.sendCommand("fileUploadCompleted", waitForResponse=True, path=remotePath, jobId=jobId)
return True
else:
self.deleteJobs([jobId])
return False
except:
self.deleteJobs([jobId])
#self.lastError = e
return False