def mkdir(req): path = req.POST.get("path") fileOperator = Utils.fileOperator() fileOperator.mkdir(path) response = { "ok": True, } return HttpResponse(json.dumps(response), content_type="application/json")
def deleteFiles(req): deleteList = req.POST.get('deleteList', None).split(",") fileOperator = Utils.fileOperator() for file in deleteList: fileOperator.forceRemove(file) response = { "ok": True, } return HttpResponse(json.dumps(response), content_type="application/json")
def copyFiles(req): needCopyFileList = req.POST.get('needCopyFileList', None).split(",") targetPath = req.POST.get('targetPath', None) isMove = req.POST.get('isMove', False) fileOperator = Utils.fileOperator() fileOperator.copyFiles(needCopyFileList, targetPath, False if isMove != "true" else True) response = { "ok": True, } return HttpResponse(json.dumps(response), content_type="application/json")
def downloadFiles(req): downloadFileList = req.POST.get("downloadFileList").split(",") print(downloadFileList) fileOperator = Utils.fileOperator() return fileOperator.zipFilesInResponse(downloadFileList)