Wipe files using sdelete ?

English support forum

Moderators: white, Hacker, petermad, Stefan2

User avatar
jslegers
Member
Member
Posts: 127
Joined: 2003-07-17, 08:13 UTC

Wipe files using sdelete ?

Post by *jslegers »

Hello,

I have made a button to start sdelete and delete the selected files. It doesn't seem to work. What I'm I doing wrong ?

Command : C:\Program Files\Totalcmd\Tools\Eraser\sdelete.exe
Parameter : -p 1 -s %s

I have also tried eraser but I'm having problems with erasing directories.
User avatar
karlchen
Power Member
Power Member
Posts: 4601
Joined: 2003-02-06, 22:23 UTC
Location: Germany

Post by *karlchen »

Hello, jsledgers.

Sysinternals Sdelete cannot handle multiple filenames/foldernames on the commandline. It just accepts 1 filename or 1 foldername.

So in in order to use the TC internal variable %S or %s you need to create a wrapper script which processes the names inside %S or %s one by one and which calls sdelete for every single marked file/foldername once.

Here is a rough sample script.
sdel.cmd wrote:@echo off
:START
if "%~f1"=="" (
echo No more args given. Done.
pause
exit /b 0
)

:WORK
attrib -h -s -r -a "%1" /S /D
"C:\Program Files\Totalcmd\Tools\Eraser\sdelete.exe" -p 1 -s "%1"

:NEXTARG
shift
goto START
Your T.C. button will read:

Code: Select all

Command : "C:\Program Files\Totalcmd\Tools\Eraser\sdel.cmd"
Parameter : %s
HTH,
Karl
--
P.S.:
Maybe this Sysinternals Forum thread will be helpful, too: My handy sdelete scripts.
--
<Corrected>
Oops, I had forgotten twice to enclose a path specification enclosing space characters in double quotes. :oops:
</Corrected>
Last edited by karlchen on 2009-02-24, 17:10 UTC, edited 2 times in total.
User avatar
jslegers
Member
Member
Posts: 127
Joined: 2003-07-17, 08:13 UTC

Post by *jslegers »

Hi Karlchen,

I have tried the button but is doesn't work. I have put the sdelete command + path between " " like this

"C:\Program Files\Totalcmd\Tools\Eraser\sdelete.exe" -p 1 -s "%1"

I thought that was the problem but nothing happens :?

John
User avatar
fenix_productions
Power Member
Power Member
Posts: 1979
Joined: 2005-08-07, 13:23 UTC
Location: Poland
Contact:

Post by *fenix_productions »

2jslegers
Are you sure you've got "Start path" field empty?
"When we created the poke, we thought it would be cool to have a feature without any specific purpose." Facebook...

#128099
User avatar
karlchen
Power Member
Power Member
Posts: 4601
Joined: 2003-02-06, 22:23 UTC
Location: Germany

Post by *karlchen »

Hi, jsledgers.

The missing double quotes around "C:\Program Files\Totalcmd\Tools\Eraser\sdelete.exe" were definitely one problem. Corrected my post. Sorry for my carelessness.

The next problem may be what fenix_productions suggests: The start path of your TC button must be empty. Else "attrib" and "sdelete" will look for the files/folders in the wrong place.

Kind regards,
Karl
User avatar
jslegers
Member
Member
Posts: 127
Joined: 2003-07-17, 08:13 UTC

Post by *jslegers »

Strange start path is empty and still no go. I see quickly a dos box but none of the files are deleted.
User avatar
karlchen
Power Member
Power Member
Posts: 4601
Joined: 2003-02-06, 22:23 UTC
Location: Germany

Post by *karlchen »

Hi, John.

A DOS box which closes automatically without your intervention?
This is strange, because the sdel.cmd should stop in case no more arguments are to be processed and wait for a keystroke before closing the console window.
if "%~f1"=="" (
echo No more args given. Done.
pause
exit /b 0
)
You have put the sdel.cmd into the folder "C:\Program Files\Totalcmd\Tools\Eraser"? And your button commandline specifies "C:\Program Files\Totalcmd\Tools\Eraser\sdel.cmd"?
Karlchen wrote:Your T.C. button will read:

Code: Select all

Command : "C:\Program Files\Totalcmd\Tools\Eraser\sdel.cmd"
Parameter : %s
[...]
<Corrected>
Oops, I had forgotten twice to enclose a path specification enclosing space characters in double quotes. :oops:
</Corrected>
Cheers,
Karl
User avatar
jslegers
Member
Member
Posts: 127
Joined: 2003-07-17, 08:13 UTC

Post by *jslegers »

Hi Karlchen,

Dos box popsup quick. This is what sdel.cmd looks like

@echo off
:START
if "%~f1"=="" (
echo No more args given. Done.
pause
exit /b 0
)

:WORK
attrib -h -s -r -a "%1" /S /D
"C:\Program Files\Totalcmd\Tools\Eraser\sdelete.exe" -p 1 -s "%1"

:NEXTARG
shift
goto START

Same as your post. And no starting dir and still not working. I have tried it on an other machine and this one also doesn't work.
User avatar
karlchen
Power Member
Power Member
Posts: 4601
Joined: 2003-02-06, 22:23 UTC
Location: Germany

Post by *karlchen »

Hi, John.

This is really weird. When I click on the TC button which launches the script and NO file/folder has been selected the console window will open and display
No more args given. Done.
Press any key to continue ...
Only when I do so the console window will close. The fact that on your machine(s) a console window pops up and closes immediately afterwards, makes me wonder whether the script gets launched at all. (Which brings us back to the commandline of your TC button.)

2nd idea:
I assume you have used copy and paste in order to create the script, i.e. copied the complete script inside your browser and pasted it into your editor window.

Some browsers add 1 trailing space character to the end of each copied line (which is wrong) and which has given me some headache before, because it made a script behave in an unexpected way.

Could this be the case here as well? Could you check and remove any trailing space characters inside your sdel.cmd script, please?

3rd idea:
If this is not the source of your trouble, then I wonder if your OS may be. The script was created and tested on Windows XP SP1 and SP2 (32bit). I would expect it to work fine on Win2K, WinXP and Win2003. But who knows?!

4th idea:
Also I wonder whether the console window which pops up displays an error message. (Maybe it closes too quickly, so you cannot read it.)
You might find out by proceeding like this:
+ open a console window, i.e. launch cmd.exe
+ copy the commandline from the TC button
+ paste it into the cmd.exe window
You should get the same message which I reported above.

Kind regards,
Karl
User avatar
jslegers
Member
Member
Posts: 127
Joined: 2003-07-17, 08:13 UTC

Post by *jslegers »

Hi Karlchen,

It looks like the problem is the parameter. When I remove the parameter. It comes with a box and an message No more args given. Done. So the script starts but it seems it can't work with %s. I have tried %S and %p%s but no result. Verry strange.
User avatar
karlchen
Power Member
Power Member
Posts: 4601
Joined: 2003-02-06, 22:23 UTC
Location: Germany

Post by *karlchen »

Good morning, John.

Without the %S / %s parameter the TC button launches the script?! Of course the script will perform no delete action in this case.

Hm, which version of TotalCommander are you using? - %S / %s works fine on TotalCommander v7.04a. I cannot remember, however, in which version %S / %s has been added.

My button configuration:
Command: "C:\Programme\Batch\sdel.cmd"
Parameter: %S
Start Path:
(Because the folder structure here is different from yours, my sdel.cmd will launch "C:\Programme\Sysinternals\sdelete.exe".)

Cheers,
Karl
User avatar
Clo
Moderator
Moderator
Posts: 5731
Joined: 2003-12-02, 19:01 UTC
Location: Bordeaux, France
Contact:

Info

Post by *Clo »

2karlchen

:) Hello Karl !
Total Commander 7.0 private beta 3.6
…07.02.07 Added: Button bar, start menu: New parameters %S and %s…
:mrgreen: VG
Claude
Clo
#31505 Traducteur Français de TC French translator Aide en Français Tutoriels Français English Tutorials
User avatar
jslegers
Member
Member
Posts: 127
Joined: 2003-07-17, 08:13 UTC

Post by *jslegers »

Hi Karlchen,

I have placed the sdel.cmd in the root and it works.

It won't work in the Total Commander path. Very strange.
jjk
Member
Member
Posts: 181
Joined: 2003-07-03, 10:41 UTC

Post by *jjk »

Perhaps with %P%S instead of %S as parameter in the icon properties ?
Also, because sdelete.exe and sdel.cmd are in the same path, in sdel.cmd I don't have put the path of sdelete.exe in the command line, only :
sdelete.exe -p 1 -s "%1"
instead of
"C:\PF\TC...\..\sdelete.exe" -p 1 -s "%1"

Here it works perfectly
User avatar
karlchen
Power Member
Power Member
Posts: 4601
Joined: 2003-02-06, 22:23 UTC
Location: Germany

Post by *karlchen »

Hi, clo.

Thanks for undigging this piece of information from the history.txt. I assume looking for search strings "%S" and "%s" needs a bit more patience than I was willing to invest. :oops:

--

Hi, John.

I cannot explain why sdel.cmd will work on your system only in case you put the file in C:\ directly. Anyway, if it works this way, I assume you can live with it for the moment.

Kind regards,
Karl
Post Reply