Need Help for creating an secure delete Script

Discuss and share scripts and script files...
sweety
Posts: 27
Joined: 21 Sep 2008 14:05
Location: Kanzach, Germany

Need Help for creating an secure delete Script

Post by sweety »

Hello every body,
i use XYplorer since an year and now i use it for my portable apps collection. So i need to remove files safe from foreigner PC's. So XYplorer don't have this feature and as explained at this thread, everybody is satisfied with the "Nuke" button. For this reason i use one of the best tools Eraser Portable. It also take care about the magnetic remanence and make safe deletion on flash disks. And the best it is free!!!

So the problem is that i cant use the portable file assosiation because the tool needs an special way to get the files and folders. So I figured out how to use the comand lines but im not able to write an script :oops: im just an out of the box user.

I hope somebody can write an script where i can choose "Secure File/Folder deletion" with [ctrl]+[alt]+[ret] or an custom shortcut.
- It schould open an Popup and ask me if i'm sure. If No then abort If yes than
- if the selection is an file we need this command(Indirect path from xyplorer):

Code: Select all

 ..\EraserPortable\App\eraser\eraserl -file ["path and file name in quotation"]
- if the selection is an folder we need this command(Indirect path from xyplorer):

Code: Select all

..\EraserPortable\App\eraser\eraserl -folder ["path in quotation"] -subfolders
- i hope this run with multi selection, so every selection need to be checked if folder or file.

I hope someone can help me.
Greetings, Anke


ps.: sorry for my english, if i have written something incomprehensible please tell me. I try to re explain my selfe ^^
Last edited by sweety on 22 Sep 2008 14:42, edited 1 time in total.

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Re: Need Help for creating an secure delete Script

Post by jacky »

Well, I haven't tested it obviously since I don't have this eraser so you might wanna test it first, but I think this should work :

1. First, you need to download this script file and put it in your Scripts folder.
2. Then, in a script file in the same Scripts folder, put the following code:

Code: Select all

"Erase All Selected Items : EraseSelectedItems"
	self $file, file;
	load (confirm("Are you sure you want to permanently erase all selected items ?") ? "load ""$file"", ""_eraserStart"";" : "status ""Erasing aborted"",,stop;"),,s;
"_eraserStart"
	self $file, file;
	setkey $file, "File", "Load", "Loop Through Selected Items.ini";
	setkey "eraser", "Name", "Load", "Loop Through Selected Items.ini";
	load "Loop Through Selected Items", "_Start";

"_eraserNothing"
	msg "You forgot to select something to delete !";
"_eraserFile"
	open """..\EraserPortable\App\eraser\eraserl"" file ""<curitem>""";
"_eraserFolder"
	open """..\EraserPortable\App\eraser\eraserl"" folder ""<curitem>"" -subfolders";
"_eraserDone"
	status "Erasing done";
Note: This is assuming you're using the latest beta, because those scripts use some new syntax/functions not available in the last official release.

Of course, to use a keyboard shortcut to trigger this, simply create a new UDC (menu User) under "Load Script File", putting the file name under Script File and EraseSelectedItems under Label, and assign a KS of your choice.
Proud XYplorer Fanatic

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,
thanks for the fast answer and the Script.
The message Box already works fine. But if i start an deletion for an file ore folder i get Scripting Error. I have atached an screenshot for you.

I use the latest beta version: v7.60.0022 as you adviced me.

ps.: the script dont throw out your message "You forgot to select something to delete !" so it doesn't come further more than the cancle button.
Attachments
erase_an_file_or_folder.png
erase_an_file_or_folder.png (13.99 KiB) Viewed 4354 times

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Re: Need Help for creating an secure delete Script

Post by jacky »

hmm... seems you have put the script above directly within XY, but for this to work in actually needs to be in a script file (so it can be called from other scripts). Simply put it in to a text file called e.g. eraser.xys and load that file and it should work then.
Proud XYplorer Fanatic

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, ok.
i have createt an file Secure Erase.xys in the Script directory. If i select an item and then Scripting->Load Script File select the file. The message Box apears and if i say ok nothing happens the file is untouch and no error apears

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Re: Need Help for creating an secure delete Script

Post by jacky »

sweety wrote:Oh, ok.
i have createt an file Secure Erase.xys in the Script directory. If i select an item and then Scripting->Load Script File select the file. The message Box apears and if i say ok nothing happens the file is untouch and no error apears
hmm.. on statusbar does it say "Erasing done" ? If so, I think it might because open actually needs a full name, so instead of "eraserl" it should probably be "eraserl.exe" on the two lines with the command open (on Secure Erase.xys)
Proud XYplorer Fanatic

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

Re: Need Help for creating an secure delete Script

Post by sweety »

So got it. You are right, we have to use the complete name of the exe file. And i had an copy and paste error at the cmdline options. forgot the "-" bevor folder and file switches. The correctet code is at the bottom.

There are two minor things left first if you select only an folder at the Treeview the script says nothing is selected. It works only at the detail view.

Second one, a little error. If i select more than on file ore directory an Warning Pop up (atached as picture) If i say continue the script works fine and start 2 instaces of the Programm.

Thanks a lot for your great help. I love the new feature =)

Code: Select all

"Erase All Selected Items : EraseSelectedItems"
   self $file, file;
   load (confirm("Are you sure you want to permanently erase all selected items ?") ? "load ""$file"", ""_eraserStart"";" : "status ""Erasing aborted"",,stop;"),,s;
"_eraserStart"
   self $file, file;
   setkey $file, "File", "Load", "Loop Through Selected Items.ini";
   setkey "eraser", "Name", "Load", "Loop Through Selected Items.ini";
   load "Loop Through Selected Items", "_Start";

"_eraserNothing"
   msg "You forgot to select something to delete !";
"_eraserFile"
   open """..\EraserPortable\App\eraser\eraserl.exe"" -file ""<curitem>""";
"_eraserFolder"
   open """..\EraserPortable\App\eraser\eraserl.exe"" -folder ""<curitem>"" -subfolders";
"_eraserDone"
   status "Erasing done";
Attachments
recursive.PNG
recursive.PNG (18.01 KiB) Viewed 4318 times

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Re: Need Help for creating an secure delete Script

Post by jacky »

sweety wrote:If i select more than on file ore directory an Warning Pop up (atached as picture) If i say continue the script works fine and start 2 instaces of the Programm.
Yes, this is because the script keeps calling itself (for each selected items) and the recursion checker generates this warning. You can actually disable that thanks to this INI Tweak ;)
Proud XYplorer Fanatic

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

Re: Need Help for creating an secure delete Script

Post by sweety »

Hello,
i need one modification or maybe an syntax update. If i only select an folder in the tree it says "You forgot to select something to delete!" Can someone fix this Problem? There are so many updates for scripting maybe the script have to be updated.

I have done some modifications:
* I updated the Script so Eraser Portable will ques more than one files ore directory. So only 1 instance is running and adding after successful deletion the next item.
* I set an other Allgorithmus so the files and folder will be overwritten only 3 times, because this is enough and saves times.

Here is the actual code which i use:

Code: Select all

"Erase All Selected Items : EraseSelectedItems"
   self $file, file;
   load (confirm("Are you sure you want to PERMANENTLY and SECURE erase ALL selected items ?") ? "load ""$file"", ""_eraserStart"";" : "status ""Erasing aborted"",,stop;"),,s;
"_eraserStart"
   self $file, file;
   setkey $file, "File", "Load", "Loop Through Selected Items.ini";
   setkey "eraser", "Name", "Load", "Loop Through Selected Items.ini";
   load "Loop Through Selected Items", "_Start";

"_eraserNothing"
   msg "You forgot to select something to delete!";
"_eraserFile"
   open """..\EraserPortable\App\eraser\eraserl.exe"" -file ""<curitem>"" -method DoD_E -queue";
"_eraserFolder"
   open """..\EraserPortable\App\eraser\eraserl.exe"" -folder ""<curitem>"" -subfolders -method DoD_E -queue";
"_eraserDone"
   status "Erasing done";
Greetings, Anke

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

Re: Need Help for creating an secure delete Script

Post by admin »

sweety wrote:Hello,
i need one modification or maybe an syntax update.
Hmmm, the script you posted does not work at all (and does not give the error you mentioned). Are you sure you posted the right one?

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

Re: Need Help for creating an secure delete Script

Post by sweety »

Yes,
i used the version witch is placed and used in my script folder. Now i added it as an File. You need the portable version of Eraser: Eraser Portable
Attachments
SecureErase.xys
(832 Bytes) Downloaded 208 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 »

Should i make screenshots of the steps how to produce the error?

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

Re: Need Help for creating an secure delete Script

Post by admin »

sweety wrote:Should i make screenshots of the steps how to produce the error?
The script has a couple of errors. It looks unfinished/untested. It can never work like this. I don't have the time to really test it with this Eraser, and I don't want to submit air code. I hope any of our scripting popes will jump in!

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

Re: Need Help for creating an secure delete Script

Post by sweety »

Thanks for the fast answer. Im sure that an "script Hero" will write an nice and new code (i don't have an clue of it :oops:)

Should i start an new Topic (for a new code) or just wait?

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

Re: Need Help for creating an secure delete Script

Post by admin »

sweety wrote:Thanks for the fast answer. Im sure that an "script Hero" will write an nice and new code (i don't have an clue of it :oops:)

Should i start an new Topic (for a new code) or just wait?
I think the topic is perfectly named and placed. I wonder why no hero rushes in for help...

Post Reply