Need Help for creating an secure delete Script

Discuss and share scripts and script files...
TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Need Help for creating an secure delete Script

Post by TheQwerty »

You can very carefully give this a try...

Code: Select all

"Secure Delete"
  $count = GetInfo("CountSelected");
  End($count < 1, "Secure Deletion Aborted:<crlf>No Selected Item(s).");
  $response = Input("Confirm Secure Deletion","Type 'yes' to confirm your desire to securely delete the $count selected item(s).");
  End(Compare($response, "yes", "i") != 0, "Secure Deletion Aborted:<crlf>Confirmation not acquired.");

  $path = '""..\EraserPortable\App\eraser\eraserl.exe""';
  $args = "-method DoD_E -queue";

  $file = '-file ""{FullName}""';
  $folder = '-folder ""{FullName}"" -subfolders';
  Load(Report("Open(""$path {Dir $folder|$file|} $args"");", "1"), "", "s");

sweety
Posts: 27
Joined: 21 Sep 2008 14:05
Location: Kanzach, Germany

Re: Need Help for creating an secure delete Script

Post by sweety »

Oh Thank You for the fast answer and the new Code, my Hero :D It makes the deletion perfect folder and files mixed, file ore folder singel. I really like the "type yes" dialog.

But 1 Problem left like in the old Code. If you just select and Folder in the Treeview you get the Popup: Secure Deletion Aborted: No Selected Item(s). I have done an screenshot to explaint it better.
Attachments
Screenshots.zip
(122.84 KiB) Downloaded 136 times

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Need Help for creating an secure delete Script

Post by TheQwerty »

sweety wrote:But 1 Problem left like in the old Code. If you just select and Folder in the Treeview you get the Popup: Secure Deletion Aborted: No Selected Item(s). I have done an screenshot to explaint it better.
Ugh.. it's never enough is it? :P

Don doesn't provide a way to determine which control has focus (without saving your entire configuration). However, from some tests and thoughts on this I believe we can safely assume most of the time, that if <focitem> and <curpath> are equal the tree has focus. This tends to work fine except in rare cases where you are able to somehow set focus to the current path in the list. (It's possible with searching multiple locations, and perhaps also junctions/linking?)

Note that I don't do any type of checking to ensure you don't run this on an entire drive or My Computer. Ideally, it could also allow you to use Eraser's drive parameter to clear empty space, but I can't think of a way to make this always work.

This is a dangerous tool so treat it as such and use extreme caution.

Code: Select all

//Global variables to define Eraser Parameters.
"_init"
	Global($eraser, $options, $fileOptions, $dirOptions);
	//Path to Eraserl.exe
	$eraser = '..\EraserPortable\App\eraser\eraserl.exe';
	//Additional options for files.
	$fileOptions = '';
	//Additional options for folders.
	$dirOptions = '-subfolders';
	//Additional arguments that follow items to delete on command line.
	$options = '-method DoD_E -queue';


//Request user confirmation before proceeding.
"_confirm"
  Global($msg);
  $response = Input("Confirmation Requested","The following item(s) will be securely deleted...<crlf><crlf>$msg<crlf><crlf>Type 'yes' to proceed with deletion:");
  End(Compare($response, "yes", "i") != 0, "Secure Deletion Aborted:<crlf>Confirmation not acquired.");

"Securely Delete..."
"-"

//Run the correct sub based on which control has focus.
"&Focused Control's Selected Items : focus"
	//Run the correct sub based on which control has focus.
	Sub((Compare("<curpath>", "<focitem>", "i") == 0) ? "tree" : "list");


//Securely delete the items selected in the list.
"&List's Selected Items : list"
	//Abort if nothing is selected.
	$count = GetInfo("CountSelected");
	End($count < 1, "Secure Deletion Aborted:<crlf>No item(s) selected in list.");

	//Request user confirmation.
	Global($msg);
	$msg = "List's Current Selection:<crlf>" . ($count < 10 ? GetInfo("SelectedItemsPathNames") : "$count selected items.");
	Sub("_confirm");

	//Delete the items.
	Global($eraser, $options, $fileOptions, $dirOptions);
	Sub("_init");
	$script = Report('Open("""' . $eraser . '"" {Dir -folder|-file|} ""{FullName}"" ' . "{Dir $dirOptions|$fileOptions|} $options"");", "1");
	Load($script, "","s");

//Securely delete the current path (Tree selection).
"&Tree's Selected Items : tree"
	$cp = "<curpath>";

	//Request user confirmation.
	Global($msg);
	$msg = "Tree's Current Selection:<crlf>$cp";
	Sub("_confirm");

	//Delete current path.
	Global($eraser, $options, $fileOptions, $dirOptions);
	Sub("_init");
	#523;  //Go up a directory.
	Open("""$eraser"" -folder ""$cp"" $dirOptions $options");
Attachments
Microwave.xys
It's for really nuking files... like a Microwave! :P
(2.09 KiB) Downloaded 149 times

sweety
Posts: 27
Joined: 21 Sep 2008 14:05
Location: Kanzach, Germany

Re: Need Help for creating an secure delete Script

Post by sweety »

Wow,
nice work. Thank you very much for your effort. Its really a great work! So if i understand you right, the code only delete The shortcuts not the linked file (same goes for junctions)? If its so, then its perfect.
Ugh.. it's never enough is it? :P
Sorry to bother you, i use xyplorer for an special usb-stick wich is bootable in an environment with no MS explorer shell (Doing my analytic/forensic/restore work). If my stick can beat some really expensive boot CD's not only in Functions also in usibility, than it "goes in production" (means some money for xyplorer). So xyplorer makes my work more comfortable. But unfortunately no one excepted me wants an secure deletion.
This is a dangerous tool so treat it as such and use extreme caution
If i delete the wrong file at work, i can search for an new job, thas why im very carefully but thanks for the warning ^_^

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Need Help for creating an secure delete Script

Post by TheQwerty »

sweety wrote:So if i understand you right, the code only delete The shortcuts not the linked file (same goes for junctions)? If its so, then its perfect.
I do believe that to be the case, but I haven't tried it. You might want to test it to make sure.
sweety wrote:Sorry to bother you, i use xyplorer for an special usb-stick wich is bootable in an environment with no MS explorer shell (Doing my analytic/forensic/restore work). If my stick can beat some really expensive boot CD's not only in Functions also in usibility, than it "goes in production" (means some money for xyplorer). So xyplorer makes my work more comfortable. But unfortunately no one excepted me wants an secure deletion.
It really wasn't a bother at all.. I don't use the tree, so didn't give it any consideration with the first version. That's one of the problems with XY and scripts - Don has given us so many ways to do things that it can be hard to account for them all when scripting. Sounds like a very interesting USB drive and collection of tools.

admin
Site Admin
Posts: 60585
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Need Help for creating an secure delete Script

Post by admin »

sweety wrote:But unfortunately no one excepted me wants an secure deletion.
Oh no, it is wished quite often! It's a very popular feature. About as popular as software for recovering deleted files. :lol: Anyway, it's on my list for some future version since a while.

sweety
Posts: 27
Joined: 21 Sep 2008 14:05
Location: Kanzach, Germany

Re: Need Help for creating an secure delete Script

Post by sweety »

Sounds like a very interesting USB drive and collection of tools
I thinks its the best ever, but every body thinks this of its own tools :D
If you are intrestet in further information whats possibel, how it looks and how to creat such things - ask, i like info sharing.

Post Reply