# raul-2000/ogzf-repo architecture

> Architecture diagram of the GitHub repository raul-2000/ogzf-repo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/raul-2000/ogzf-repo
- Repository: https://github.com/raul-2000/ogzf-repo

## Overview

#### Purpose and Entry Point
OGZF is a Linux command-line file organizer. Its sole executable implementation is [`ogzf.sh`](ogzf.sh); [`README.md`](README.md) defines its CLI contract and installation flow. It recursively scans a user-supplied root directory and places files into extension-based category folders.

#### Runtime and Dependencies
The utility runs under Bash on Linux and relies on standard GNU/POSIX shell utilities for traversal, filesystem operations, and path handling. It has no application server, database, package runtime, cloud infrastructure, or external API dependencies. Installation may expose [`ogzf.sh`](ogzf.sh) as `/usr/local/bin/ogzf`.

#### Invocation and Mode Selection
The shell entry point accepts a required main folder plus optional control arguments:
- Default mode copies files, preserving sources.
- `--move` / `-m` changes the terminal filesystem action from copy to move.
- Normal filtering treats the supplied comma-separated paths as exclusions.
- `exclude-all` reverses filtering semantics: only supplied paths are eligible.

Argument parsing and mode state belong in [`ogzf.sh`](ogzf.sh), while expected argument forms are documented in [`README.md`](README.md).

#### Recursive Discovery and Eligibility Boundary
The processing pipeline recursively traverses content below the target root. Before organizing a discovered file, OGZF applies either exclusion matching or inclusive-path matching. This filter boundary determines which source files enter the organizer and prevents explicitly excluded paths from being acted upon. The behavior is defined by the CLI semantics in [`README.md`](README.md) and implemented in [`ogzf.sh`](ogzf.sh).

#### Classification and Destination Layout
Eligible files are classified from their extension into Images, Videos, Documents, Spreadsheets, Audio, Archives, or Others. Classification maps each file to a category destination folder under the organization target. Unknown extensions are routed to Others. The category taxonomy is the central data model described in [`README.md`](README.md) and realized by [`ogzf.sh`](ogzf.sh).

#### Collision-Safe Materialization
Before writing a destination file, OGZF checks for existing names and generates numbered variants such as `photo (1).jpg`. This collision-resolution stage is a safety boundary: it avoids overwriting prior organized output. The final action then copies by default or moves only when explicitly requested. Both safety guarantees and duplicate behavior are specified in [`README.md`](README.md) and enforced by [`ogzf.sh`](ogzf.sh).

#### Operational Characteristics
The target directory is both the scan scope and filesystem boundary; all effects are local filesystem reads plus category-directory creation and copy/move writes. Copy mode is the recommended non-destructive path, while move mode intentionally removes original source locations after successful relocation. There are no persistent metadata stores, background workers, or network interactions.

Main entry points: [`ogzf.sh`](https://github.com/raul-2000/ogzf-repo/blob/main/ogzf.sh) (Argument parsing), [`README.md`](https://github.com/raul-2000/ogzf-repo/blob/main/README.md) (README)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI contract"]
  node_readme["README<br/>documentation<br/>[README.md]"]
  node_entrypoint["ogzf.sh<br/>Bash CLI<br/>[ogzf.sh]"]
end

subgraph group_pipeline["Organization pipeline"]
  node_arg_parsing["Argument parsing<br/>CLI mode state<br/>[ogzf.sh]"]
  node_scan_root["Target root scan<br/>recursive traversal<br/>[ogzf.sh]"]
  node_eligibility_filter["Eligibility filter<br/>path filter<br/>[ogzf.sh]"]
  node_classifier["Extension classifier<br/>category mapping<br/>[ogzf.sh]"]
  node_destination_layout["Category destinations<br/>directory layout<br/>[ogzf.sh]"]
  node_collision_resolution["Collision resolver<br/>write safety<br/>[ogzf.sh]"]
  node_copy_action["Copy action<br/>filesystem write<br/>[ogzf.sh]"]
  node_move_action["Move action<br/>filesystem write<br/>[ogzf.sh]"]
end

subgraph group_filesystem["Local filesystem"]
  node_source_files["Source files<br/>local files"]
  node_category_folders["Category folders<br/>local directories"]
  node_organized_output["Organized files<br/>local files"]
end

node_readme -.->|"documents"| node_entrypoint
node_entrypoint -->|"invokes"| node_arg_parsing
node_arg_parsing -->|"supplies root"| node_scan_root
node_source_files -->|"scan scope"| node_scan_root
node_scan_root -->|"discovered files"| node_eligibility_filter
node_arg_parsing -->|"filter mode and paths"| node_eligibility_filter
node_eligibility_filter -->|"eligible files"| node_classifier
node_classifier -->|"category"| node_destination_layout
node_destination_layout -->|"destination path"| node_collision_resolution
node_collision_resolution -->|"default mode"| node_copy_action
node_collision_resolution -->|"--move / -m"| node_move_action
node_destination_layout -->|"creates/selects"| node_category_folders
node_copy_action -->|"copies"| node_organized_output
node_move_action -->|"moves"| node_organized_output
node_category_folders -->|"contains"| node_organized_output

click node_readme "https://github.com/raul-2000/ogzf-repo/blob/main/README.md"
click node_entrypoint "https://github.com/raul-2000/ogzf-repo/blob/main/ogzf.sh"
click node_arg_parsing "https://github.com/raul-2000/ogzf-repo/blob/main/ogzf.sh"
click node_scan_root "https://github.com/raul-2000/ogzf-repo/blob/main/ogzf.sh"
click node_eligibility_filter "https://github.com/raul-2000/ogzf-repo/blob/main/ogzf.sh"
click node_classifier "https://github.com/raul-2000/ogzf-repo/blob/main/ogzf.sh"
click node_destination_layout "https://github.com/raul-2000/ogzf-repo/blob/main/ogzf.sh"
click node_collision_resolution "https://github.com/raul-2000/ogzf-repo/blob/main/ogzf.sh"
click node_copy_action "https://github.com/raul-2000/ogzf-repo/blob/main/ogzf.sh"
click node_move_action "https://github.com/raul-2000/ogzf-repo/blob/main/ogzf.sh"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_readme,node_entrypoint toneBlue
class node_arg_parsing,node_scan_root,node_eligibility_filter,node_classifier,node_destination_layout,node_collision_resolution,node_copy_action,node_move_action toneAmber
class node_source_files,node_category_folders,node_organized_output toneMint
```

## Components

### CLI contract

- [README](https://github.com/raul-2000/ogzf-repo/blob/main/README.md): documentation · Defines installation, arguments, filtering, categories, and safety behavior. · `README.md`
- [ogzf.sh](https://github.com/raul-2000/ogzf-repo/blob/main/ogzf.sh): Bash CLI · Sole executable implementation. · `ogzf.sh`

### Organization pipeline

- [Argument parsing](https://github.com/raul-2000/ogzf-repo/blob/main/ogzf.sh): CLI mode state · Reads root, move mode, and path-list controls. · `ogzf.sh`
- [Target root scan](https://github.com/raul-2000/ogzf-repo/blob/main/ogzf.sh): recursive traversal · Discovers files beneath the supplied root directory. · `ogzf.sh`
- [Eligibility filter](https://github.com/raul-2000/ogzf-repo/blob/main/ogzf.sh): path filter · Applies exclusions or exclude-all inclusion semantics. · `ogzf.sh`
- [Extension classifier](https://github.com/raul-2000/ogzf-repo/blob/main/ogzf.sh): category mapping · Maps extensions to Images, Videos, Documents, Spreadsheets, Audio, Archives, or Others. · `ogzf.sh`
- [Category destinations](https://github.com/raul-2000/ogzf-repo/blob/main/ogzf.sh): directory layout · Selects category folders under the organization target. · `ogzf.sh`
- [Collision resolver](https://github.com/raul-2000/ogzf-repo/blob/main/ogzf.sh): write safety · Generates numbered destination names to prevent overwrites. · `ogzf.sh`
- [Copy action](https://github.com/raul-2000/ogzf-repo/blob/main/ogzf.sh): filesystem write · Default non-destructive materialization. · `ogzf.sh`
- [Move action](https://github.com/raul-2000/ogzf-repo/blob/main/ogzf.sh): filesystem write · Relocates eligible files when explicitly selected. · `ogzf.sh`

### Local filesystem

- **Source files**: local files · Files located within the user-supplied target root.
- **Category folders**: local directories · Created beneath the target root for organized output.
- **Organized files**: local files · Collision-safe copied or moved output.

## Connections

- README → ogzf.sh: documents
- ogzf.sh → Argument parsing: invokes
- Argument parsing → Target root scan: supplies root
- Source files → Target root scan: scan scope
- Target root scan → Eligibility filter: discovered files
- Argument parsing → Eligibility filter: filter mode and paths
- Eligibility filter → Extension classifier: eligible files
- Extension classifier → Category destinations: category
- Category destinations → Collision resolver: destination path
- Collision resolver → Copy action: default mode
- Collision resolver → Move action: --move / -m
- Category destinations → Category folders: creates/selects
- Copy action → Organized files: copies
- Move action → Organized files: moves
- Category folders → Organized files: contains
