WinRAR - Using rar.exe command line to extract all files in all archives in a folder then delete all the archives?

0

I want to use rar.exe via command line to extract all files in all archives in a folder then delete all the archives automatically if they extracted successfully? I tried -df and -dr to no avail. Seems like those may only for deleting the files if you're adding them to an archive.

Right now I'm using (c#):

string.Format("e -p{0} \"{1}\" *.* \"{2}\"", pass, fi[n].FullName, fi[n].DirectoryName)

Mike G

Posted 2014-07-20T07:52:57.387

Reputation: 1

Rather than what you're doing in C#, please always show the actual commands that are called. – slhck – 2014-07-20T11:04:33.067

Answers

0

Seems like those may only for deleting the files if you're adding them to an archive.

Seems to be the case, yes,

$ unrar --help | grep -i unrar
UNRAR 5.00 beta 8 freeware      Copyright (c) 1993-2013 Alexander Roshal
Usage:     unrar command -switch1 -switchN archive files...
$ unrar --help | grep del
$ unrar --help | grep unlink
$ unrar --help | grep rem

... no mention of removing anything.

Hannu

Posted 2014-07-20T07:52:57.387

Reputation: 4 950

0

I guess you could do something like

  • Use Process class to execute rar.exe

  • Process.WaitForExit

  • Validate whether the files have been extracted

    (You could just estimate size, if you want to do it quick and dirty...)

  • If validation passes, delete the archive

Nekyo

Posted 2014-07-20T07:52:57.387

Reputation: 1