Skip to content

Python CLI tool for archiving large projects by version and pattern matching

Notifications You must be signed in to change notification settings

Phantom138/projectArchiver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 

Repository files navigation

Project Archiver

Python CLI tool for archiving large projects by version and pattern matching.

Currently only working in Windows.

Not the most performant tool, sruggles with directories that have more than 50k files. It is meant for smaller directories with large files.

Installation

Install python 3.10 or higher. When installing tick Add python to PATH

Download the github project and navigate to the download location in the terminal.

Usage

Basic Usage

It is recommended to first run it with the --check flag. This is not going to archive anything, just check how much data should be kept.

python archiveProj.py <source_path> <archive_path> --check

Replace <source_path> with the path to the project directory you want to archive, and <archive_path> with the desired location for the archived project.

By adding also the --output flag, you can see which files are matched and which are not.

By also adding the --verbose flag, you can see more detailed output.

python archiveProj.py <source_path> <archive_path> --check --output --verbose

When running in CMD, appending | more at the end is going to enable you to go line-by-line. It is recommended to use it when the output is too long to see.

python archiveProj.py <source_path> <archive_path> --check --output --verbose | more

Once you are happy with the file selection, archive by using the following command:

python archiveProj.py <source_path> <archive_path>

<archive_path> should be an empty/non-existent directory

Parameters

Parameter Description
--check-rules Check if the rules are detected properly.
--verbose Enable verbose output.
--check Show the data to be kept or ignored before archiving.
--output Enables output during the checking process.

Rule Specification

The Project Archiver allows you to specify rules for managing project files and directories in a rules.txt file. For an example usage, see the rules.txt file

Specify options using @ decorator. Comments are preceded by #. Supported options: ignore_empty, keep_versions

  • @ignore_empty: specifies if it should ignore empty directories/files. Note: directory is considered empty when it's size is 0kb. Default: False

  • @keep_versions: specifies that how many latest versions should be kept. Default: 1

  • Lines starting with ! denote patterns to ignore. For example, !*.tx ignores all files with the .tx extension.

  • Lines without a prefix specify patterns to keep. For example, */my_file.txt keeps all files named my_file.txt.

  • For matching directories add a / at the end. For example, */dir/ matches all directories named dir

You can check if your rules are detected by running:

python archiveProj.py <source_path> <archive_path> --check-rules

About

Python CLI tool for archiving large projects by version and pattern matching

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages