Skip to content

πŸ› οΈ A Zig-based mv alternative with automatic conflict resolution β€” adds numeric suffixes when files already exist. Fast, lightweight, and cross-platform.

License

Notifications You must be signed in to change notification settings

gauravnumber/move.zig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

37 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

move

A Zig-based utility that enhances file and directory moving capabilities with smart conflict resolution. Unlike the standard mv command, move automatically handles naming conflicts by appending indices to filenames or directory names.

Features

  • πŸš€ Zero runtime dependencies
  • ⚑ Compiled and blazing fast
  • πŸ”„ Smart conflict resolution
  • πŸ“ Supports both files and directories
  • πŸ”’ Handles multiple sources
  • πŸ› οΈ Written in Zig

Installation

🧱 Build from Source

For Android (32-bit ARM)

zig build-exe move.zig -target arm-linux-androideabi -femit-bin=move

This will output a binary named move that runs on 32-bit Android systems (e.g., Termux).

For Windows

zig build-exe move.zig

This builds a move.exe file for Windows (native architecture).

Optional: Move to Global Path

After building, you can move the binary to a directory in your system’s PATH:

mv move /usr/local/bin/   # For Linux/Android
move move.exe C:\Windows\System32   # For Windows (requires admin)

Usage

# Basic usage
move <source_path> <destination_path>

# Move multiple files to a directory
move <file1> <file2> ... <target_directory>

Examples

1. Moving a Single File

Initial structure:

.
β”œβ”€β”€ 1.txt
β”œβ”€β”€ 2.txt
β”œβ”€β”€ 3.txt
β”œβ”€β”€ 4.txt
β”œβ”€β”€ 5.txt
└── 6.txt

Command:

move 1.txt 2.txt

Result:

.
β”œβ”€β”€ 2.txt
β”œβ”€β”€ 2_1.txt  # 1.txt was moved and renamed to avoid conflict
β”œβ”€β”€ 3.txt
β”œβ”€β”€ 4.txt
β”œβ”€β”€ 5.txt
└── 6.txt

2. Moving Multiple Files

Command:

move 1.txt 2.txt 3.txt destination_folder/

3. Moving Directories

Command:

move source_directory/ destination_directory/

Supported Operations

  • move fileA fileB – Move and rename fileA to fileB with conflict resolution
  • move file1 file2 file3 targetDir – Move multiple files into a directory
  • move dir1 dir2/ – Move a directory into another directory

How It Works

When a naming conflict occurs, move automatically:

  1. Detects if the destination path already exists
  2. Appends an incremental index suffix like _1, _2, etc.
  3. Moves the file or directory safely without overwriting existing content

Why Zig?

Zig provides:

  • ⚑ Native performance
  • 🧩 Minimal binary size
  • 🧠 Simple, predictable behavior
  • 🌐 Cross-compilation built-in

License

MIT

About

πŸ› οΈ A Zig-based mv alternative with automatic conflict resolution β€” adds numeric suffixes when files already exist. Fast, lightweight, and cross-platform.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages