rename-pattern

command module
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2022 License: BSD-3-Clause Imports: 10 Imported by: 0

README

rename-pattern

a file rename tool with simple *? style matchmatch or regexp match.

install

go install github.com/mixcode/rename-pattern@latest
simple help

rename-pattern --help

Examples

  • substitute all 'hello' to 'world' in ZIP files
# '*' and '?' matches filenames
# the '-d' flag rename files
rename-pattern -d hello world *.zip
  • substitute file_1.zip to name_001.zip
# ':' matches digits
rename-pattern -d file_: name_%03d *.zip
  • substitute file_1.zip to 001_name.zip
# $POS or %[POS] referes a match at the position
# '|' is a matching group separator
rename-pattern -d '*|_:' '%[3]03d_$1' *.zip

# ${POS} is same with $POS
rename-pattern -d '*|_:' '%[3]03d_${1}' *.zip
  • '-r' flag: use regexp for match
rename-pattern -d -r '(\d+)' %03d *.zip
  • use '-s' to feed filenames from STDIN
ls -1 \*.zip | rename-pattern -d : %05d

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL