diff --git a/Program.cs b/Program.cs index 7fc0437..dca1078 100644 --- a/Program.cs +++ b/Program.cs @@ -279,6 +279,19 @@ public static int Main_OneArgument(string[] args) Console.WriteLine("z3: triple rewrite: 0xCCCC 0x6666 0x00"); } + if (flags.Contains("ndd")) + { + progress.doNotDeleteDirectories = 1; + Console.WriteLine("ndd - do not delete directories"); + } + + if (flags.Contains("_ndf")) + { + progress.doNotDeleteFiles = 1; + progress.doNotDeleteDirectories = 1; + Console.WriteLine("_ndf - do not delete files"); + } + var creationMode = flags.Contains("cr"); if (creationMode) { @@ -319,11 +332,16 @@ public static int Main_OneArgument(string[] args) if (progress.createWithSimpleDeleting > 0) { - if (verbose > 0) - Console.WriteLine($"Usually directory deleting (without additional rewriting)"); + if (progress.doNotDeleteDirectories == 0) + { + if (verbose > 0) + Console.WriteLine($"Usually directory deleting (without additional rewriting)"); - Directory.Delete(path, true); - Console.WriteLine($"Program ended with time {progress.getMessageForEntireTimeOfSanitization}. Deletion successfull ended for directory '{path}'"); + Directory.Delete(path, true); + Console.WriteLine($"Program ended with time {progress.getMessageForEntireTimeOfSanitization}. Deletion successfull ended for directory '{path}'"); + } + else + Console.WriteLine($"Program ended with time {progress.getMessageForEntireTimeOfSanitization}. Creation successfull ended for directory '{path}'"); Console.CursorVisible = true; return 0; @@ -389,7 +407,7 @@ public static int Main_OneArgument(string[] args) if (flags.Contains("pr")) { var dt = progress.creationTime; - progress = new Progress(SizeToRewrite: fi.Length, cntToRewrite: 1, progress: progress); + progress = new Progress(SizeToRewrite: fi.Length, cntToRewrite: 1, progress: progress) { showProgressFlag = 1 }; progress.creationTime = dt; } @@ -453,7 +471,7 @@ public static int Main_OneArgument(string[] args) var list = di.EnumerateFiles("*", SearchOption.AllDirectories); var dt = progress.creationTime; - progress = new Progress(progress: progress); + progress = new Progress(progress: progress) { showProgressFlag = 1 }; progress.creationTime = dt; foreach (var file in list) diff --git a/build.sh b/build.sh index 136be86..7e34045 100644 --- a/build.sh +++ b/build.sh @@ -18,6 +18,8 @@ dotnet publish --output ./publish/build.lin64sc -c Release -r linux-x64 --self-c 7z a -y -t7z -stl -m0=lzma -mx=9 -ms=on -bb0 -bd -ssc -ssw ./publish/sdel-lin64.7z ./publish/build.lin64/ >> /dev/null 7z a -y -t7z -stl -m0=lzma -mx=9 -ms=on -bb0 -bd -ssc -ssw ./publish/sdel-lin64sc.7z ./publish/build.lin64sc/ >> /dev/null +echo +date echo echo 'Published in ' echo `realpath ./publish` diff --git a/publish/sdel-dotnet.7z b/publish/sdel-dotnet.7z index 446dcac..1a9feb4 100644 Binary files a/publish/sdel-dotnet.7z and b/publish/sdel-dotnet.7z differ diff --git a/publish/sdel-lin64.7z b/publish/sdel-lin64.7z index b92d16f..430af3e 100644 Binary files a/publish/sdel-lin64.7z and b/publish/sdel-lin64.7z differ diff --git a/publish/sdel-lin64sc.7z b/publish/sdel-lin64sc.7z index 174db1e..c6c195d 100644 Binary files a/publish/sdel-lin64sc.7z and b/publish/sdel-lin64sc.7z differ diff --git a/readme.md b/readme.md index 4caf118..f455a9a 100644 --- a/readme.md +++ b/readme.md @@ -140,8 +140,6 @@ but if there is equipment for physical connection to the microcontroller, then t Overwriting an empty space on a hard (magnetic) disk. sudo sdel crds_prv_sl ~/_toErase -Then you can delete the directory in the usual way (through the functions of the operating system) -sudo rm -rf ~/_toErase After such a rewrite, it is recommended to clear the inode. @@ -151,13 +149,13 @@ After such a rewrite, it is recommended to clear the inode. Overwriting an empty space on an SSD or flash drive (the essence is the same only in different cases). -sudo sdel crd_ndf_prv_sl ~/_toErase +sudo sdel crds_ndf_prv_sl ~/_toErase sudo sdel _ndf_pr ~/_toErase sudo rm -rf ~/_toErase OR -sudo sdel crd_ndf_prv_sl ~/_toErase +sudo sdel crds_ndf_prv_sl ~/_toErase sudo sdel _ndf_pr ~/_toErase sudo sdel pr ~/_toErase @@ -307,23 +305,21 @@ sdel z_prv /swapfile Перезапись пустого места на жёстком (магнитном) диске. sudo sdel crds_prv_sl ~/_toErase -Затем можно удалить директорию обычным образом (через функции операционной системы) -sudo rm -rf ~/_toErase -После такой перезаписи рекомендуется очистить inode. +После такой перезаписи рекомендуется очистить inode (иными программами). "sl" замедлит перезапись, так как будет вставлять паузы. Это позволит избежать существенного замедления других программ. "~/_toErase" - это несуществующая директория, которая будет создана программой. Она должна быть расположена на том диске, который мы хотим перезаписать. Перезапись пустого места на SSD или флеш-накопителе (суть одно и то же только в разных корпусах). -sudo sdel crd_ndf_prv_sl ~/_toErase +sudo sdel crds_ndf_prv_sl ~/_toErase sudo sdel _ndf_pr ~/_toErase sudo rm -rf ~/_toErase ИЛИ -sudo sdel crd_ndf_prv_sl ~/_toErase +sudo sdel crds_ndf_prv_sl ~/_toErase sudo sdel _ndf_pr ~/_toErase sudo sdel pr ~/_toErase