Wipe files using sdelete ?
Moderators: white, Hacker, petermad, Stefan2
Wipe files using sdelete ?
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.
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.
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.
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.
</Corrected>
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.
Your T.C. button will read: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
Code: Select all
Command : "C:\Program Files\Totalcmd\Tools\Eraser\sdel.cmd"
Parameter : %s
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.
</Corrected>
Last edited by karlchen on 2009-02-24, 17:10 UTC, edited 2 times in total.
- fenix_productions
- Power Member
- Posts: 1979
- Joined: 2005-08-07, 13:23 UTC
- Location: Poland
- Contact:
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
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
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.
Karl
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.
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"?if "%~f1"=="" (
echo No more args given. Done.
pause
exit /b 0
)
Cheers,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.
</Corrected>
Karl
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.
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.
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
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
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
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.)No more args given. Done.
Press any key to continue ...
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
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:
Cheers,
Karl
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:
(Because the folder structure here is different from yours, my sdel.cmd will launch "C:\Programme\Sysinternals\sdelete.exe".)Command: "C:\Programme\Batch\sdel.cmd"
Parameter: %S
Start Path:
Cheers,
Karl
Info
2karlchen
Hello Karl !
Claude
Clo
Hello Karl !
VGTotal Commander 7.0 private beta 3.6
…07.02.07 Added: Button bar, start menu: New parameters %S and %s…
Claude
Clo
#31505 Traducteur Français de T•C French translator Aide en Français Tutoriels Français English Tutorials
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
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
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.
--
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
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.
--
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