Skip to main content

Python tools to print strings to markdown file with styles. Also allows printing dicts and lists to table

Project description


Pypi version Wheel Status Pypi Licence

Python tools for finding last file or folder number in a directory based on extension, prefix or suffix.


Simply install using pip

pip install filenumutils


If your current directory has the following files and folders

  • folders: [train_00, train_01, train_02, train_03, train_04]
  • files: [,,]

Get Last Folder / File Number

from filenumutils import get_last_folder_number, get_last_file_number
get_last_folder_number(prefix="model_")       # Output: 4
get_last_file_number(prefix="train_")         # Output: 2

If no such file/folder with given prefix exists, it outputs -1

Get Next Folder / File Name

from filenumutils import get_next_file, get_next_folder
get_next_file(prefix="model_")                      # Output:
get_next_folder(prefix="train_", create=True)       # Output: train_05 (Folder is created)
get_next_folder(prefix="test_", create=True)        # Output: test_00 (Folder is created)

If no such folder with given prefix exists, it outputs prefix_00.

Also, it will automatically stick to the existing numbering pattern. For eg, if the folders were [train_0000, train_0001],

get_next_folder(prefix="train_", create=True)       # Output: train_0000 (Folder is created)

More Options

Attribute Default Description
path Current Directory Do operations in the given directory
prefix "" Match only files with given prefix
suffix "" Match only files with given extension/suffix
default_number_width 2 When no numbering pattern is found, output number will be default_number_width digits
return_with_path True By default, return path/new_folder_name. If false, return only new_folder_name.


Pull requests are very welcome.

  1. Fork the repo
  2. Create new branch with feature name as branch name
  3. Check if things work with a jupyter notebook
  4. Raise a pull request


Please see attached Licence

Project details

Download files

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

Files for filenumutils, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size filenumutils-0.1.1-py3-none-any.whl (4.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size filenumutils-0.1.1.tar.gz (3.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page