# Nulcleaner

> Finds and deletes Windows-reserved NUL files created by using /dev/null in Git Bash. Headless or with GUI.

- Skill: `ellmos-ai/nulcleaner-2` (Agent Skill)
- Install (CLI): `npx skillmds@latest add ellmos-ai/nulcleaner-2`
- Raw SKILL.md: https://api.skillmd.com/api/skills/ellmos-ai/nulcleaner-2/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: ellmos-ai (https://skillmd.com/u/ellmos-ai)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/ellmos-ai/nulcleaner-2

---


<img src="banner.png" width="100%" alt="nulcleaner banner">

> **English** — Official English version of `nulcleaner`.


# nulcleaner - Windows NUL File Cleanup

## The Problem

When `/dev/null` is used in commands under Git Bash on Windows (e.g., `> /dev/null`),
instead of redirecting to nowhere, an actual **file named `nul`** is created in the current
directory. Windows reserves "NUL" as a device name, which means these files cannot be
deleted normally.

This tool finds and deletes such NUL files via the extended UNC path (`\\?\`).

---

## Modes

| Mode | Description |
|------|-------------|
| `scan` | Recursively scan directory for NUL files |
| `delete` | Find and delete NUL files |
| `gui` | Graphical interface with file selection |

---

## CLI Usage

```bash
# Scan only (shows found NUL files) (Deutsch)
python nulcleaner.py scan /path/to/directory

# Scan and delete (Deutsch)
python nulcleaner.py delete /path/to/directory

# Start GUI mode (Deutsch)
python nulcleaner.py gui
```

---

## Headless API (for Integration)

The tool also provides a Python API for headless operation:

```python
from nulcleaner import clean_nul_files_headless

result = clean_nul_files_headless("/path/to/directory", verbose=True)
print(f"Found: {result['found']}, Deleted: {result['deleted']}")
```

**Return value:** `{'found': int, 'deleted': int, 'errors': list}`

---

## Technical Details

- Uses the extended UNC path (`\\?\`) to delete Windows-reserved filenames
- Recursive scan with `os.walk()`
- GUI with tkinter (no external dependencies)
- Only works on Windows (where the problem occurs)

---

## Prevention

Best to avoid `/dev/null` in Git Bash altogether. Instead:
- Simply omit the output
- Use `2>&1` for stderr redirection
- Pay attention to Windows compatibility in shell scripts

