Skip to main content

Create a database of all the items of a directory

Project description

Create a database of all the items of a directory

Installation

Clone the repo: git clone https://github.com/RadoTheProgrammer/tetris Install the dependencies: pip install -r requirements.txt

Usage

Create the database:

import main
db = main.FilesDatabase.create(<your src>)

It is a table, a subclass of pandas dataframe, the columns are the following:

  • name: name of the item, relative path
  • size: size in bytes
  • n: number of items and sub-items
  • ctime: creation time
  • mtime: modification time
  • atime: last access time
  • level: how deep the item is from the root
  • nls: number of items (-1 if file)

You can use pandas native function sort_values

db_size = db.sort_values("size",ascending=False) # Get which items takes the most place
db_timeline = db.sort_values("ctime") # Get a timeline of items by their creation date

Other features:

db_ls = db.ls() # extract all root items
db_sub = db("foo/bar") # navigate in the database by getting into 1 specific item
db.only_dirs() # select only the dirs
db.only_files() # select only the files
db.pin_columns("nls") # pin a column(s) when you're more interested into a particular one

db.to_csv(<file>) # Export into a file
db = main.read_csv(<file>) # Import a database of file

And then you can save it into a file by db.to_csv(<file>) simply like pandas, and use a tool like Data Wrangler or Excel to view and analyse this data freely.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

files_db2-0.1.tar.gz (60.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

files_db2-0.1-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file files_db2-0.1.tar.gz.

File metadata

  • Download URL: files_db2-0.1.tar.gz
  • Upload date:
  • Size: 60.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for files_db2-0.1.tar.gz
Algorithm Hash digest
SHA256 641f0ae68e90a9f50cfab2442516fcc3d1a09e241e5e09343a06dadb0d807361
MD5 a9ff9d80c28b20d5d1b0e6f0632871d4
BLAKE2b-256 55ee510ba9f936e326523b0e23ef654f2abb44674b4ac7e6014528f187adb408

See more details on using hashes here.

File details

Details for the file files_db2-0.1-py3-none-any.whl.

File metadata

  • Download URL: files_db2-0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for files_db2-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 52c2f4b703b8aa8d7458c169219dda510128dab46e48b6448ab10d6ab8b985db
MD5 aaeea510ebf5417a2137c8ee2239a270
BLAKE2b-256 06338f182772bbb24ac09e0865d97a3ff6860be5d365a1fd9082d866f717b510

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page