new unpack option: delete after successful unpack

Here you can propose new features, make suggestions etc.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
derdiedas
Junior Member
Junior Member
Posts: 6
Joined: 2009-11-02, 07:53 UTC

new unpack option: delete after successful unpack

Post 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.
:)
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post 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.
derdiedas
Junior Member
Junior Member
Posts: 6
Joined: 2009-11-02, 07:53 UTC

Post by *derdiedas »

Thanks for the idea. But honestly I'd rather mark a checkbox.
:}
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post 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.
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post 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.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post 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.
derdiedas
Junior Member
Junior Member
Posts: 6
Joined: 2009-11-02, 07:53 UTC

Post 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!!
User avatar
GammelBert
Member
Member
Posts: 109
Joined: 2007-02-21, 18:42 UTC
Location: Germany

Post 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%"
}
Post Reply