#cli #file-rename #mv #upper-case

app smv

Smart Move - An enhanced mv command with transformation capabilities

2 releases

new 0.1.2 Apr 25, 2025
0.1.1 Apr 25, 2025

#294 in Filesystem

MIT license

60KB
1K SLoC

SMV - Smart Move

A powerful, Rust-based drop-in replacement for the standard Unix mv command with intelligent filename transformation capabilities.

Features

  • Drop-in replacement for the standard Unix mv command
  • Interactive REPL Interface with command history and tab completion
  • Smart File Renaming with multiple transformation strategies:
    • Convert to snake_case (document-name.pdfdocument_name.pdf)
    • Convert to kebab-case (document_name.pdfdocument-name.pdf)
    • Convert to Title Case (document_name.pdfDocument Name.pdf)
    • Convert to camelCase (document_name.pdfdocumentName.pdf)
    • Convert to PascalCase (document_name.pdfDocumentName.pdf)
    • Convert to lowercase or UPPERCASE
    • Clean up spaces and special characters
  • Preview Mode - See changes before they're applied
  • Batch Processing - Apply transformations to multiple files at once
  • Undo Functionality - Safely revert changes
  • Safety Features - File backups and conflict detection

Installation

Using Cargo

cargo install smv

From Source

# Clone the repository
git clone https://github.com/jwliles/smv.git
cd smv

# Build and install
cargo install --path .

Usage

Basic Usage (like standard mv)

SMV works exactly like the standard mv command for basic moving and renaming:

# Move a file to another location
smv file.txt /path/to/destination/

# Move multiple files to a directory
smv file1.txt file2.txt destination_directory/

# Rename a file
smv old_name.txt new_name.txt

Transformation Mode

Apply transformations to filenames:

# Convert filenames to snake_case
smv --snake *.txt

# Convert filenames to kebab-case with preview
smv --preview --kebab *.pdf

# Clean up spaces and special characters recursively
smv --recursive --clean --directory /path/to/messy/files/

# Convert to Title Case for specific extensions
smv --title --extensions "md,txt" documents/

# Combine transformations with standard move behavior
smv --snake *.txt destination_folder/

Interactive Mode

Launch the interactive REPL interface:

# Start interactive session
smv -i
# or
smv --interactive

In the interactive shell:

smv> ls
document.pdf document.docx image.jpg notes.txt

smv> preview snake *.pdf
document.pdf → document.pdf (no change needed)

smv> rename notes.txt
...
Select transformation:
  1. Clean up spaces and special characters
  ...
  4. Convert to Title Case
...
Preview of changes:
  "notes.txt""Notes.txt"
Apply these changes? [y/N] y
Renamed: "notes.txt""Notes.txt"

smv> undo
Operation undone successfully.

smv> help
Commands:
  preview <transform> <files>  - Show transformation without applying
  apply <transform> <files>    - Apply transformation
  rename <files> --options     - Interactive renaming wizard
  undo                        - Revert last operation
  cd <directory>              - Change directory
  ls [pattern]                - List files
  help                        - Show this help
  quit                        - Exit program

Full Command Options

Options:
  -i, --interactive            Launch interactive REPL interface
  -p, --preview                Preview changes without applying them
  -r, --recursive              Process subdirectories recursively
  -e, --extensions <EXTENSIONS>  Comma-separated list of file extensions to process
  -a, --remove-accents         Remove accents from filenames
      --clean                  Clean up spaces and special characters
      --snake                  Convert filenames to snake_case
      --kebab                  Convert filenames to kebab-case
      --title                  Convert filenames to Title Case
      --camel                  Convert filenames to camelCase
      --pascal                 Convert filenames to PascalCase
      --lower                  Convert filenames to lowercase
      --upper                  Convert filenames to UPPERCASE
      --dry-run                Same as preview - show changes without applying
      --exclude <PATTERNS>     Comma-separated patterns to exclude
      --max-history-size <SIZE>  Maximum number of operations in history [default: 50]
  -h, --help                   Print help
  -V, --version                Print version

Transformations

Transform Description Example
clean Clean up spaces and special characters My File (1).txtMy File 1.txt
snake Convert to snake_case My-File.txtmy_file.txt
kebab Convert to kebab-case My_File.txtmy-file.txt
title Convert to Title Case my_file.txtMy File.txt
camel Convert to camelCase my_file.txtmyFile.txt
pascal Convert to PascalCase my_file.txtMyFile.txt
lower Convert to lowercase MyFile.txtmyfile.txt
upper Convert to UPPERCASE myFile.txtMYFILE.TXT

Safety Features

Backups

SMV automatically creates backups of modified files in ~/.config/smv/backups/. This allows the undo functionality to work even after the program has been closed and reopened.

Undo Functionality

The undo command reverts the most recent operation. In interactive mode, you can use:

smv> undo

Conflict Detection

SMV will not overwrite existing files unless explicitly instructed to do so, preventing accidental data loss.

Requirements

  • Rust (Minimum supported version: 1.85.0)
  • Standard system libraries

Roadmap

  • Multi-step transformation pipelines: Chain multiple transforms together

    # Example: Clean, convert to snake_case, then replace spaces with underscores
    smv --transform "clean,snake,replace:space:_" file.txt
    
  • Regular expression-based transformations: Advanced pattern replacement

    # Example: Replace "old" with "new" in filenames
    smv --replace "old:new" file.txt
    # Example: Replace all digits with 'X'
    smv --character-replace "digits:X" file*.txt
    
  • Custom user-defined transformations: Save your own transform combinations

    # Example: Save a custom transformation
    smv --save "my-format:clean,snake,upper"
    # Use the custom transformation
    smv --transform my-format file.txt
    
  • Configuration file system: Persistent settings and defaults

  • Directory synchronization features: Keep renamed files in sync

  • Plugin system for add-ons: Extend functionality

  • Enhanced REPL with syntax highlighting: Improved interactive mode

  • Color-coded preview output: Visual differentiation of changes

License

MIT License

Dependencies

~9–18MB
~233K SLoC