Tarstats - A simple Python commandline application that collects statistics about tarfiles

Related tags

CLI Tools tarstats
Overview

tarstats - Generate some statistics about a tarfile.

A simple Python commandline application that collects statistics about tarfiles.

Installation

$ pip3 install .

The dot after install is important.

Usage

Get help:

$ tarstats -h
usage: tarstats [-h] [-j] [-t] tarfile [tarfile ...]

Print some stats about tarfiles.

positional arguments:
  tarfile       A tarfile to print stats on.

optional arguments:
  -h, --help    show this help message and exit
  -j, --json    Print the stats as json.
  -t, --totals  Also print a total over all tarfiles.

Get stats:

$ tarstats testtar.tgz
type: archive
name: testtar.tgz
size: 112640
filesize: 547
files: 2
dirs: 1
symlinks: 1
hardlinks: 0
devices: 0

Get stats in json:

$ tarstats -j testtar.tgz
{"type": "archive", "name": "testtar.tgz", "size": 112640, "filesize": 547, "files": 2, "dirs": 1, "symlinks": 1, "hardlinks": 0, "dev": 0}

Get stats (in json) for more than one file + totals:

$ tarstats -tj testtar.tgz testtar.tgz
{"type": "archive", "name": "testtar.tgz", "size": 112640, "filesize": 547, "files": 2, "dirs": 1, "symlinks": 1, "hardlinks": 0, "dev": 0}
{"type": "archive", "name": "testtar.tgz", "size": 112640, "filesize": 547, "files": 2, "dirs": 1, "symlinks": 1, "hardlinks": 0, "dev": 0}
{"type": "total", "name": "total", "size": 225280, "filesize": 1094, "files": 4, "dirs": 2, "symlinks": 2, "hardlinks": 0, "dev": 0}
You might also like...
jrnl is a simple journal application for the command line.
jrnl is a simple journal application for the command line.

jrnl To get help, submit an issue on Github. jrnl is a simple journal application for the command line. You can use it to easily create, search, and v

A simple CLI application helps you to find giant files that are eating up your system storage
A simple CLI application helps you to find giant files that are eating up your system storage

Large file finder Sometimes it's very hard to find if some giant files are eating up your system storage. We might need to hunt those down. This simpl

This is a simple Termo application in command line style
This is a simple Termo application in command line style

my-termo This is a simple Termo application in command line style. This app run a Linux crontab task every day to get a new word. Type termo in your t

🐍The nx-python plugin allows users to create a basic python application using nx commands.
🐍The nx-python plugin allows users to create a basic python application using nx commands.

🐍 NxPy: Nx Python plugin This project was generated using Nx. The nx-python plugin allows users to create a basic python application using nx command

Doro is a CLI based pomodoro app and countdown timer application built using python.
Doro is a CLI based pomodoro app and countdown timer application built using python.

Doro - CLI based pomodoro app Doro is a CLI based pomodoro app and countdown timer application built using python. Install $ pip install doro Usage Po

A CLI application for storing contacts as a csv file written in Python.

Contacter A CLI application for storing contacts as a csv file written in Python. You can use this to save your contacts with a special relations tag

A command line application, written in Python, for interacting with Spotify.
A command line application, written in Python, for interacting with Spotify.

spotify-py-cli A command line application, written in Python, for interacting with Spotify. The primary purpose behind developing this app was to gain

A CLI minesweeper application written in 60 LoC python

This is a CLI minesweeper application written in 60 LoC python. You can use d row,column to dig and f row,column to flag/unflag

A python-based terminal application that displays current cryptocurrency prices
A python-based terminal application that displays current cryptocurrency prices

CryptoAssetPrices A python-based terminal application that displays current cryptocurrency prices. Covered Cryptocurrencies Bitcoin (BTC) Ethereum (ET

Comments
  • human readable output

    human readable output

    It would be wonderful if there would be an human readable option (-H resp. --human-readable ) , something like

    type: archive
    name: foo.txz
    size: 91m
    filesize: 19m
    files: 4.568
    
    enhancement help wanted good first issue 
    opened by rainerrose 2
  • Fix invalid namespace reference

    Fix invalid namespace reference

    Fixes:

    β†’ ./tarstats.py NONEXISTENT
    Traceback (most recent call last):
      File "/home/juergen/ghq/github.com/isotopp/tarstats/./tarstats.py", line 188, in tarstats
        stats = tarstat(name)
      File "/home/juergen/ghq/github.com/isotopp/tarstats/./tarstats.py", line 143, in tarstat
        with tarfile.open(filename, "r") as t:
      File "/usr/lib/python3.10/tarfile.py", line 1613, in open
        return func(name, "r", fileobj, **kwargs)
      File "/usr/lib/python3.10/tarfile.py", line 1679, in gzopen
        fileobj = GzipFile(name, mode + "b", compresslevel, fileobj)
      File "/usr/lib/python3.10/gzip.py", line 174, in __init__
        fileobj = self.myfileobj = builtins.open(filename, mode or 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: 'NONEXISTENT'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/home/juergen/ghq/github.com/isotopp/tarstats/./tarstats.py", line 227, in <module>
        main()
      File "/home/juergen/ghq/github.com/isotopp/tarstats/./tarstats.py", line 223, in main
        tarstats(args.tarfile, args.json, args.totals)
      File "/home/juergen/ghq/github.com/isotopp/tarstats/./tarstats.py", line 190, in tarstats
        print(f"Can't read '{name}': {e}", file=sys.stderr)
    NameError: name 'sys' is not defined
    
    
    opened by juergenhoetzel 1
  • Count compressed size

    Count compressed size

    The size listed currently is the accumulated uncompressed size for each archive.

    Further interesting stats are:

    • Header + block (alignment) overhead
    • Compressed file size (i.e. the analyzed file's size)

    The latter is mostly of interest, when more than one archive is processed at once.

    enhancement help wanted 
    opened by BenBE 2
Owner
Kristian Koehntopp
Kristian Koehntopp
Commandline Python app to Autodownload mediafire folders and files.

Commandline Python app to Autodownload mediafire folders and files.

Tharuk Renuja 3 May 12, 2022
Commandline script to interact with volkswagencarnet library

volkswagencarnet-client command line script to interact with volkswagencarnet library Table of Contents General Info Setup Usage Example Acknowledgeme

null 3 Jan 19, 2022
pypinfo is a simple CLI to access PyPI download statistics via Google's BigQuery.

pypinfo: View PyPI download statistics with ease. pypinfo is a simple CLI to access PyPI download statistics via Google's BigQuery. Installation pypin

Ofek Lev 351 Dec 26, 2022
topalias - Linux alias generator from bash/zsh command history with statistics, written on Python.

topalias topalias - Linux alias generator from bash/zsh command history with statistics, written on Python. Features Generate short alias for popular

Sergey Chudakov 38 May 26, 2022
eBay's TSV Utilities: Command line tools for large, tabular data files. Filtering, statistics, sampling, joins and more.

Command line utilities for tabular data files This is a set of command line utilities for manipulating large tabular data files. Files of numeric and

eBay 1.4k Jan 9, 2023
A simple terminal-based localhost chat application written in python

Chat House A simple terminal-based localhost chat application written in python How to Use? Clone the repo git clone https://github.com/heksadecimal/c

Heks 10 Nov 9, 2021
A simple python application for running a CI pipeline locally

A simple python application for running a CI pipeline locally This app currently supports GitLab CI scripts

Tom Stowe 0 Jan 11, 2022
CryptoCo-py is a Python CLI application that uses CoinGecko API to allow the user to query cryptocurrency information by typing simple commands.

CryptoCo-py is a Python CLI application that uses CoinGecko API to allow the user to query cryptocurrency information by typing simple com

null 1 Jan 10, 2022
Cthulhu is a simple python CLI application that streams torrents directly from 1337x.

Cthulhu is a simple python CLI application that facilitates the streaming of torrents directly from 1337x. It uses webtorrent to stream video

Raiyan 27 Dec 27, 2022
A super simple wallet application for the NANO cryptocurrency that runs in the terminal

Nano Terminal Wallet A super simple wallet application for the NANO cryptocurrency that runs in the terminal Written in 2021 by NinjaSnail1080 (Discor

null 9 Jul 22, 2022