topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Monday March 18, 2024, 10:03 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: IDEA: Batch read nfo files in RAR archives  (Read 10383 times)

wetsmellydog

  • Participant
  • Joined in 2007
  • *
  • Posts: 120
    • View Profile
    • Donate to Member
IDEA: Batch read nfo files in RAR archives
« on: February 03, 2008, 09:19 PM »
I am starting to clean out a bunch of software program files from years ago.
Some are in ZIP format but most are RAR. Inside these compressed files is an information text file with the extension of .nfo.

I would like to be able to copy the name of the archive and the text of the nfo file to a separate file so that I can determine if I want to keep or delete the archive. It is also helpful when I archive to a cd/dvd as a content file.

There are plenty of programs that will search out a ZIP file and do just what I want but not any that work with RAR that I have found. I am willing to use command line batch file if anyone is knowledgeable about the RAR archive program.

As always, many thanks in advance!

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,169
    • View Profile
    • Donate to Member
Re: IDEA: Batch read nfo files in RAR archives
« Reply #1 on: February 05, 2008, 04:22 PM »
I think the command line tool UnRAR , http://www.rarlab.com/rar_add.htm , can do what you want, at least in combination with some scripting language like autohotkey.

this command line phrase would extract only .nfo files from the archive:
unrar e -n*.nfo ARCHIVE_NAME.rar
I don't have time to put together a working script at the moment. :-[ But hopefully you or someone else can do it.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: IDEA: Batch read nfo files in RAR archives
« Reply #2 on: February 05, 2008, 05:03 PM »
You could combine nod5's commandline hint with my drag+drop robot program to handle lots of files:
https://www.donation.../dragdrop/index.html

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 933
    • View Profile
    • 1 Hour Software by skrommel
    • Donate to Member
Re: IDEA: Batch read nfo files in RAR archives
« Reply #3 on: February 10, 2008, 07:10 AM »
 :) Try TheDIZs!

Extracts DIZ- and NFO-files from RAR-files.
Place UnRar.exe from www.winrar.com in the same folder as TheDIZs.

You can run it to have it ask for a root folder, or add a folder to the command line.

Skrommel

;TheDIZs.ahk
; Extracts DIZ- and NFO-files from RAR-files.
; Place UnRar.exe from www.winrar.com in the same folder as TheDIZs
;Skrommel @ 2008

#SingleInstance,Ignore
#NoEnv
SetBatchLines,-1

If 0=0
{
  FileSelectFolder,start,,3,Select a folder to search for RAR files
  If start=
  {
    MsgBox,0,TheDIZs,You didn't select a folder.
    ExitApp
  }
}   
Else
  start=%1%

crlf:=Chr(13) . Chr(10)
folder:=A_Now
FileDelete,TheDIZs.txt
FileAppend,Scan started %A_Now%%crlf%,TheDIZs.txt

Loop,%start%\*.rar,0,1
{
  FileCreateDir,%A_Temp%\%folder%\
  archive:=A_LoopFileLongPath
  TrayTip,TheDIZs,Scanning %archive%
  RunWait,unrar e -n*.diz -p- %archive% %A_Temp%\%folder%\,,Hide
  RunWait,unrar e -n*.nfo -p- %archive% %A_Temp%\%folder%\,,Hide
  Loop,%A_Temp%\%folder%\*.*
  {
    diz:=A_LoopFileLongPath
    FileRead,content,%diz%
    FileAppend,-----------%crlf%%archive%%crlf%-----------%crlf%%content%%crlf%%crlf%%crlf%,TheDIZs.txt
    FileDelete,%diz%
  }
}

FileRemoveDir,%A_Temp%\%folder%\
FileAppend,Scan stopped %A_Now%%crlf%,TheDIZs.txt
Run,TheDIZs.txt

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: IDEA: Batch read nfo files in RAR archives
« Reply #4 on: February 10, 2008, 07:18 AM »
You pirates! :)
- carpe noctem

wetsmellydog

  • Participant
  • Joined in 2007
  • *
  • Posts: 120
    • View Profile
    • Donate to Member
Re: IDEA: Batch read nfo files in RAR archives
« Reply #5 on: February 12, 2008, 09:12 PM »
:) Try TheDIZs!

Extracts DIZ- and NFO-files from RAR-files.
Place UnRar.exe from www.winrar.com in the same folder as TheDIZs.

You can run it to have it ask for a root folder, or add a folder to the command line.

Skrommel

;TheDIZs.ahk
; Extracts DIZ- and NFO-files from RAR-files.
; Place UnRar.exe from www.winrar.com in the same folder as TheDIZs
;Skrommel @ 2008

#SingleInstance,Ignore
#NoEnv
SetBatchLines,-1

If 0=0
{
  FileSelectFolder,start,,3,Select a folder to search for RAR files
  If start=
  {
    MsgBox,0,TheDIZs,You didn't select a folder.
    ExitApp
  }
}   
Else
  start=%1%

crlf:=Chr(13) . Chr(10)
folder:=A_Now
FileDelete,TheDIZs.txt
FileAppend,Scan started %A_Now%%crlf%,TheDIZs.txt

Loop,%start%\*.rar,0,1
{
  FileCreateDir,%A_Temp%\%folder%\
  archive:=A_LoopFileLongPath
  TrayTip,TheDIZs,Scanning %archive%
  RunWait,unrar e -n*.diz -p- %archive% %A_Temp%\%folder%\,,Hide
  RunWait,unrar e -n*.nfo -p- %archive% %A_Temp%\%folder%\,,Hide
  Loop,%A_Temp%\%folder%\*.*
  {
    diz:=A_LoopFileLongPath
    FileRead,content,%diz%
    FileAppend,-----------%crlf%%archive%%crlf%-----------%crlf%%content%%crlf%%crlf%%crlf%,TheDIZs.txt
    FileDelete,%diz%
  }
}

FileRemoveDir,%A_Temp%\%folder%\
FileAppend,Scan stopped %A_Now%%crlf%,TheDIZs.txt
Run,TheDIZs.txt

Well I finally had a chance to try this out (school has been a bitch!) but I am not getting the result I am sure you did.

This is all the text file shows when it is done
Scan started 20080212201023
Scan stopped 20080212201023

unrar.exe is in the same directory as the script.

Any idea?

Thanks!

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 933
    • View Profile
    • 1 Hour Software by skrommel
    • Donate to Member
Re: IDEA: Batch read nfo files in RAR archives
« Reply #6 on: February 16, 2008, 02:58 AM »
 :tellme: It skips encrypted RARs. Probably not the problem?

Skrommel