Page 1 of 1
new unpack option: delete after successful unpack
Posted: 2009-11-02, 09:54 UTC
by derdiedas
The first thing I do after a successful unpack is usually to delete the original packed file. Actually this is what I do 99% of the time.
So I crave for TC to do it for me.

Posted: 2009-11-02, 17:56 UTC
by MVV
I think you should create BAT file that will call your external archiver (7-Zip, WinRAR etc) to unpack file and then to remove it. So, when you need to unpack and delete archive, you will call this batch. You may pass source archive name and target directory name with archive name as new folder or to unpack directly to targer dir.
Posted: 2009-11-02, 20:13 UTC
by derdiedas
Thanks for the idea. But honestly I'd rather mark a checkbox.
:}
Posted: 2009-11-02, 20:19 UTC
by MVV
I think such checkbox is not the one that should be placed onto _unpack_ dialog. Because unpack and delete is _quite_ different things and if TC will remember state of such checkbox it may be dangerous.
Posted: 2009-11-02, 20:28 UTC
by Balderstrom
AFAIK Mr.Ghisler doesn't like things that Auto-Delete, so you'll likely never see that checkbox.
We can't even get an option to not Nag/PopUp for file Deletes (that will go to the recycle bin).
The internal pack/unpack is functionally limited compared to a real Archive-utility. I appreciate the ability to browse (Ctrl+PgDn) archives as folders. Yet if I'm actually unpacking I almost always use WinRar -- as again the internal unpack has no option to 1click unpack to the same Panel.
Posted: 2009-11-03, 04:40 UTC
by MVV
Code: Select all
@echo off
rem First parameter is path to archive, second is unpack path
if -%2==- goto exit
if not exist %2 md %2
unrar.exe x %1 *.* %2
echo Press a key to kill archive
pause
del %1
:exit
cls
This simple UnpackAndKill.bat will extract all contents of archive into specified folder. You may replace line
unrar.exe x %1 *.* %2 with
7z.exe x -o%2 %1 *.* to use 7-Zip instead of UnRar.exe. Also you need to specify full path to archiver executable.
To use this file you need to create following toolbar button:
Command:
UnpackAndKill.bat (with full path)
Params:
%P%N %T%O (this will extract to folder with archive name in target panel; if you don't want to create subfolder, remove
%O; if you want to extract near the archive, just use %P instead of
%T%O)
Start path: (empty)
Other fields: as you like.
Also you may create custom user-command for this task, and assign some shortcut key to it.
Posted: 2009-11-03, 08:54 UTC
by derdiedas
Thanks a lot for the insight!
I cannot ignore those arguments against such an option.
And I am most thankful for the bat example!
Thanks - I'll give it a try!!
Posted: 2010-04-06, 21:40 UTC
by GammelBert
some script for AutoHotkey and WinRAR. I prefer WinRAR over 7-zip because it waits if another instance is already extracting something.
Code: Select all
; in Total Commander use %P%N as Parameters (without quotes). Do not set working dir to extract in folder where archive is located
#SingleInstance off
winrarPath:="d:\aamProgramme\WinRAR\WinRAR.exe"
; ask before deleting archive?
askForConfirmation:= true
archiveFile = %1%
; x: extract
winrarParameters = x "%archiveFile%"
RunWait, "%winrarPath%" %winrarParameters%
; if WinRAR exit code is 0, extraction was successful
if (ErrorLevel == 0)
{
if (askForConfirmation)
{
;4 is message box type Yes/No, 256: make 2nd button default
MsgBox, 260, delete after extract?, Extraction successful.`n`nDelete "%archiveFile%" to recycle bin?
IfMsgBox Yes
{
deleteFile(archiveFile)
}
}
else
deleteFile(archiveFile)
}
else
MsgBox, There was an error extracting %archiveFile%
deleteFile(file)
{
FileRecycle, %file%
if (ErrorLevel)
MsgBox, Error deleting "%file%"
}