public string CopyFrom(IUploadStorage store, string sourcePath, string targetPath, bool autoRename) { if (string.IsNullOrEmpty(sourcePath)) { throw new ArgumentNullException(sourcePath); } if (IsInternalFile(sourcePath)) { throw new ArgumentOutOfRangeException(nameof(sourcePath)); } if (string.IsNullOrEmpty(targetPath)) { throw new ArgumentNullException(nameof(targetPath)); } if (IsInternalFile(targetPath)) { throw new ArgumentOutOfRangeException(nameof(targetPath)); } var newFiles = new List <string>(); using var source = store.OpenFile(sourcePath); targetPath = WriteFile(targetPath, source, autoRename); newFiles.Add(targetPath); try { var sourceBasePath = Path.ChangeExtension(sourcePath, null); var sourceBaseName = Path.GetFileNameWithoutExtension(sourceBasePath); var targetBasePath = Path.ChangeExtension(targetPath, null); var sourceDir = Path.GetDirectoryName(sourcePath); foreach (var f in store.GetFiles(sourceDir, sourceBaseName + "_t*.jpg")) { string thumbSuffix = Path.GetFileName(f)[sourceBaseName.Length..];