Delete-By-Relative UserSecretsId

This commit is contained in:
2023-06-11 09:16:54 -07:00
parent f4b5a3a47c
commit 145610d45a
3 changed files with 22 additions and 253 deletions

View File

@ -59,24 +59,27 @@ public class DeleteByRelative
throw new NullReferenceException(nameof(alongSideDirectory));
string deleteLog = Path.Combine(alongSideDirectory, $"{directoryName}-{ticks}.tsv");
File.WriteAllLines(deleteLog, deleteFiles);
log.Information($"Ready to delete {deleteFiles.Count} file(s)? See <{deleteLog}>");
for (int y = 0; y < int.MaxValue; y++)
if (deleteFiles.Any())
{
log.Information("Press \"Y\" key to delete file(s) or close console to not delete files");
if (Console.ReadKey().Key == ConsoleKey.Y)
break;
log.Information($"Ready to delete {deleteFiles.Count} file(s)? See <{deleteLog}>");
for (int y = 0; y < int.MaxValue; y++)
{
log.Information("Press \"Y\" key to delete file(s) or close console to not delete files");
if (Console.ReadKey().Key == ConsoleKey.Y)
break;
}
log.Information(". . .");
foreach (string deleteFile in deleteFiles)
{
File.Delete(deleteFile);
checkFileName = $"{deleteFile}.id";
if (!File.Exists(checkFileName))
continue;
File.Delete(checkFileName);
}
for (int i = 1; i < 5; i++)
_ = Shared.Models.Stateless.Methods.IPath.DeleteEmptyDirectories(appSettings.CompareRootDirectory);
}
log.Information(". . .");
foreach (string deleteFile in deleteFiles)
{
File.Delete(deleteFile);
checkFileName = $"{deleteFile}.id";
if (!File.Exists(checkFileName))
continue;
File.Delete(checkFileName);
}
for (int i = 1; i < 5; i++)
_ = Shared.Models.Stateless.Methods.IPath.DeleteEmptyDirectories(appSettings.CompareRootDirectory);
}
}