0

I'm running the following code in powershell

$list=C:\"Program Files (x86)"\WinRAR\unRAR.exe v -v $absolutePath
$list

And this is my output:

Archivo C:\Users\Maxi\Desktop\pruebaz\pruebaz.rar

Ruta/Comentario
                  Tamaño   Compresión  Fecha   Hora     Atrib     CRC   Métod-Ver-
-------------------------------------------------------------------------------
 pruebaz\chu.jpg
                 63171    61575  97% 19-09-13 17:10  .....A.   B5F99319 m3b 2.9
 pruebaz\nada\hola\cruci.jpg
                 55306    54496  98% 16-11-13 02:03  .....A.   87537917 m3b 2.9
 pruebaz\nada\hola
                     0        0   0% 15-07-14 23:01  .D.....   00000000 m0  2.0
 pruebaz\nada
                     0        0   0% 15-07-14 23:01  .D.....   00000000 m0  2.0
 pruebaz
                     0        0   0% 15-07-14 23:01  .D.....   00000000 m0  2.0
-------------------------------------------------------------------------------
    5           118477   116071  97%

I need help filtering this to get the following:

pruebaz\chu.jpg             
pruebaz\nada\hola\cruci.jpg      
pruebaz\nada\hola               
pruebaz\nada                
pruebaz

Thanks.

  • Try using the [`unrar.exe lb pruebaz.rar`](http://stackoverflow.com/a/14316921/21567). It seems that gives you a plain file list. – Christian.K Jul 16 '14 at 04:23
  • this gives me: `chu.jpg cruci.jpg hola nada pruebaz` but not the path, just a list of things inside the rar file. I need a list of things in the rar file, but with it's corresponding path – Maximiliano Schultheis Jul 16 '14 at 04:32
  • Too bad. I haven't the tools at hand, so I cannot play around with them myself. My point was: try to find a command line option that produces a simpler (to parse) output. I figured `lb` could be it. – Christian.K Jul 16 '14 at 04:34
  • Thanks, I will keep playing around with it. – Maximiliano Schultheis Jul 16 '14 at 04:37
  • @MaximilianoSchultheis: `unrar.exe lb` gave me an output like `directory directory\file` with each item listed in a separate line, using unRAR 5.00. Are you seeing a different thing? Are you using a different version maybe? – PeterK Jul 16 '14 at 07:08
  • Oh yes, I'm using version 3.93. I'll try again after upgrading, thanks! – Maximiliano Schultheis Jul 16 '14 at 16:28

1 Answers1

0

Not sure if this answers your question, or what the output type is for the unrar command, but you could try to pipe $list into Get-Member

$list | Get-Member

If the output of that gives you a Member Type of Property you can access that directly with

$list.PropertyName

For example with Get-ChildItem you can

$list = Get-ChildItem $list | Get-Member

Giving the following partial output.

enter image description here

And then use

$list.FullName

Paul Rowland
  • 8,244
  • 12
  • 55
  • 76