Menu

How to Get 7-Zip Hash Command Output on One Line?

raywood
2022-06-20
2022-06-21
  • raywood

    raywood - 2022-06-20

    I am using 7-Zip in Linux, but will be happy to get clues from the comparable Windows command.

    I have a file named 1310. To hash that file, I enter this;

    7zz h -scrcblake2sp /path-to-file/1310

    That gives me a boatload of material, like this:


    7-Zip (z) 22.00 (x64) : Copyright (c) 1999-2022 Igor Pavlov : 2022-06-15
    64-bit locale=enUS.UTF-8 Threads:4, ASM

    Scanning
    1 file, 525465333 bytes (502 MiB)

    BLAKE2sp Size Name


    e1e24f94859d2373f43edb4ffab9dadfe1c677f6a68b258af0ae9807cb74eb13 525465333 1310


    e1e24f94859d2373f43edb4ffab9dadfe1c677f6a68b258af0ae9807cb74eb13 525465333

    Size: 525465333

    BLAKE2sp for data: e1e24f94859d2373f43edb4ffab9dadfe1c677f6a68b258af0ae9807cb74eb13

    Everything is Ok*

    All I want is the one line that mentions the file's name, size, and hash. It's the one that looks like this:

    e1e24f94859d2373f43edb4ffab9dadfe1c677f6a68b258af0ae9807cb74eb13 525465333 1310

    To get that one line of output per file, is there some 7-zip option that I am overlooking?

    I could use the Linux findstr command to pull out that one line, if I were doing this only for file no. 1310; but in fact I expect to do it, at times, for long lists of files, sometimes for all files in a folder or drive. My Linux scripting abilities are not remotely at the level to know how to use the filename as a variable in a loop.

    Suggestions?

     

    Last edit: raywood 2022-06-20
  • raywood

    raywood - 2022-06-21

    Very helpful. Thank you.

    Is there a way to include timestamp (i.e., each file's modification date and time) in the output?

     

    Last edit: raywood 2022-06-21
  • Igor Pavlov

    Igor Pavlov - 2022-06-21

    Timestamps in that list are not implemented.

     
    👍
    1

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.