2

I have successfully extracted data from a large .rar archive (1.9TB) using 7-zip and now I want to delete the archive. However, before I do so, I would like to save path names and, most importantly, the corresponding CRC values that are listed in the CRC column in the 7-zip file manager.

The only way to do this that I know of is via cmd.exe with the following command 7z l -slt <archive.zip>. However, this method is not very efficient for my purposes. For one thing, command prompt's output window is limited in size. I know that I can adjust buffer size (perhaps even up to 32766), but the archive has over a million files... What is even more problematic, though, is the fact that the output of this method has a format that, as far as I know, cannot be altered and it is as follows:

Path = -
Folder = -
Size = -
Packed Size = -
Modified = -
Created =
Accessed =
Attributes = -
Encrypted = -
Solid = -
Commented = -
Split Before = -
Split After = -
CRC = -
Host OS = -
Method = -
Version = -
Volume Index = -

Whereas what I'm looking for is an output per file that looks like this:

<CRC> <pathname>

For example:

60CD248A *Folder1\text1.txt
61CD248A *Folder1\Folder2\text1.txt
62CD248A *Folder1\Folder2\text2.txt

Many thanks for your time and help.

an531
  • 95

1 Answers1

4

You can use one line command code to get only CRC lines from command line output:

7z l -slt archive.zip >> "%tmp%\output.txt" && type "%tmp%\output.txt"|findstr /b CRC | clip && del /q /f "%tmp%\output.txt"

This command will put in your clipboard (Crtl+C) all lines contents CRC - ..... from 7z command output.

To save in a file:

7z l -slt archive.zip >> "%tmp%\output.txt" && type "%tmp%\output.txt"|findstr /b CRC >>"c:\my_folder\my_save_output.txt" && del /q /f "%tmp%\output.txt"

To loop (via "for") and save CRC strings:

for /f tokens^=2*^delims^=^ ^-^  %i in ('7z l -slt archive.zip^|findstr /b CRC')do @echo/%i>>"c:\my_folder\my_save_output.txt"
  • My 7Z version output looks like CRC = STRINGS, in my case, the delimiter changes to:
for /f tokens^=^2*^delims^=^=^  %i in ('7za l -slt archive.zip ^| find /i "crc"')do @echo/%i>>"c:\my_folder\my_save_output.txt"

Obs.: 1) There are 2 spaces in between ^=^= and %i:

delims^=^=%i  --->  delims^=^=^  %i 

Obs.: 2) The same apply to Path, just replace CRC to Path.

Obs.: 3) The executable file in portable version used is 7za.exe, may your have another name.

X X
  • 157
Io-oI
  • 9,237