public Task PutAsync(string targetFilename, string sourceFilePath, CancellationToken cancelToken) { string targetFilePath = GetRemoteName(targetFilename); if (m_moveFile) { if (systemIO.FileExists(targetFilePath)) { systemIO.FileDelete(targetFilePath); } var sourceFileInfo = new FileInfo(sourceFilePath); var sourceFileLength = sourceFileInfo.Exists ? (long?)sourceFileInfo.Length : null; systemIO.FileMove(sourceFilePath, targetFilePath); if (m_verifyDestinationLength) { VerifyMatchingSize(targetFilePath, null, sourceFileLength); } } else { systemIO.FileCopy(sourceFilePath, targetFilePath, true); if (m_verifyDestinationLength) { VerifyMatchingSize(targetFilePath, sourceFilePath); } } return(Task.FromResult(true)); }
public virtual void TearDown() { if (systemIO.DirectoryExists(this.DATAFOLDER)) { systemIO.DirectoryDelete(this.DATAFOLDER, true); } if (systemIO.DirectoryExists(this.TARGETFOLDER)) { systemIO.DirectoryDelete(this.TARGETFOLDER, true); } if (systemIO.DirectoryExists(this.RESTOREFOLDER)) { systemIO.DirectoryDelete(this.RESTOREFOLDER, true); } if (systemIO.FileExists(this.LOGFILE)) { systemIO.FileDelete(this.LOGFILE); } if (systemIO.FileExists(this.DBFILE)) { systemIO.FileDelete(this.DBFILE); } if (systemIO.FileExists($"{this.DBFILE}-journal")) { systemIO.FileDelete($"{this.DBFILE}-journal"); } }
public void CleanUp(string path) { if (!_systemio.DirectoryExists(path)) { logger.LogError(path + " not found"); throw new ArgumentException(path + " not found"); } if (!_systemio.DirectoryExists(path + "/.archive")) { return; } var files = _systemio.DirectoryGetFiles(path + "/.archive"); foreach (var file in files) { var info = _fileInfoIO.Load(file); if (_systemio.FileExists(info.Filename)) { continue; } _systemio.FileDelete(file); } }