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)
1
  • Rather than what you're doing in C#, please always show the actual commands that are called.
    – slhck
    Jul 20, 2014 at 11:04

2 Answers 2

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.

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .