Skip to content

Releases: shenwei356/brename

v2.7.0

24 Jun 12:44
Compare
Choose a tag to compare

Changelog

  • add flag -u/--undo and -U/--force-undo to undo the LAST successful operation

brename v2.6.0

10 Apr 16:19
Compare
Choose a tag to compare

Changelog

  • better conflict detection
  • add flag -o/--overwrite-mode to choose 0) reporting error, 1) overwriting existed files or 2) skipping renaming.

Example

$ ls *.tar.gz
    brename_darwin_386.tar.gz    brename_linux_386.tar.gz    brename_windows_386.exe.tar.gz
    brename_darwin_amd64.tar.gz  brename_linux_amd64.tar.gz  brename_windows_amd64.exe.tar.gz
  1. default mode: reporting error

     $ brename -p 386 -r amd64 -d
     [ERRO] checking: [ new path existed ] 'brename_darwin_386.tar.gz' -> 'brename_darwin_amd64.tar.gz'
     [ERRO] checking: [ new path existed ] 'brename_linux_386.tar.gz' -> 'brename_linux_amd64.tar.gz'
     [ERRO] checking: [ new path existed ] 'brename_windows_386.exe.tar.gz' -> 'brename_windows_amd64.exe.tar.gz'
     [ERRO] 3 potential error(s) detected, please check
    
  2. allowing overwrite

     $ brename -p 386 -r amd64 -d -o 1
     [WARN] checking: [ new path existed ] 'brename_darwin_386.tar.gz' -> 'brename_darwin_amd64.tar.gz' (will be overwrited)
     [WARN] checking: [ new path existed ] 'brename_linux_386.tar.gz' -> 'brename_linux_amd64.tar.gz' (will be overwrited)
     [WARN] checking: [ new path existed ] 'brename_windows_386.exe.tar.gz' -> 'brename_windows_amd64.exe.tar.gz' (will be overwrited)
     [INFO] 3 path(s) to be renamed
    
  3. leave it

     $ brename -p 386 -r amd64 -d -o 2
     [WARN] checking: [ new path existed ] 'brename_darwin_386.tar.gz' -> 'brename_darwin_amd64.tar.gz' (will NOT be overwrited)
     [WARN] checking: [ new path existed ] 'brename_linux_386.tar.gz' -> 'brename_linux_amd64.tar.gz' (will NOT be overwrited)
     [WARN] checking: [ new path existed ] 'brename_windows_386.exe.tar.gz' -> 'brename_windows_amd64.exe.tar.gz' (will NOT be overwrited)
     [INFO] 0 path(s) to be renamed
    
  4. this flag also works for another case, where two or more files are renamed to same new path

     $ brename -f 386 -p 'darwin|linux' -r unix-like -d
     [INFO] checking: [ ok ] 'brename_darwin_386.tar.gz' -> 'brename_unix-like_386.tar.gz'
     [ERRO] checking: [ overwriting newly renamed path ] 'brename_linux_386.tar.gz' -> 'brename_unix-like_386.tar.gz'
     [ERRO] 1 potential error(s) detected, please check
    
     $ brename -f 386 -p 'darwin|linux' -r unix-like -d -o 1
     [INFO] checking: [ ok ] 'brename_darwin_386.tar.gz' -> 'brename_unix-like_386.tar.gz'
     [WARN] checking: [ overwriting newly renamed path ] 'brename_linux_386.tar.gz' -> 'brename_unix-like_386.tar.gz' (will be overwrited)
     [INFO] 2 path(s) to be renamed
    
     $ brename -f 386 -p 'darwin|linux' -r unix-like -d -o 2
     [INFO] checking: [ ok ] 'brename_darwin_386.tar.gz' -> 'brename_unix-like_386.tar.gz'
     [WARN] checking: [ overwriting newly renamed path ] 'brename_linux_386.tar.gz' -> 'brename_unix-like_386.tar.gz' (will NOT be overwrited)
     [INFO] 1 path(s) to be renamed
    

brename v2.5.2

19 Mar 17:25
Compare
Choose a tag to compare

Changelog

  • add flag --nr-width to fill leading 0s for {nr}. e.g.,

      $ brename -f '.jpeg' -e -p '(.+)' -r 'pic-{nr}' --nr-width 3 -d
      [INFO] checking: [ ok ] 'a.jpeg' -> 'pic-001.jpeg'
      [INFO] checking: [ ok ] 'b.jpeg' -> 'pic-002.jpeg'
      [INFO] 2 path(s) to be renamed
    

brename v2.5.1

18 Jan 05:46
Compare
Choose a tag to compare

Changelog

  • add flag -a/--list-abs to list absolute path, using along with flag -l/--list

brename v2.5.0

16 Jan 12:06
Compare
Choose a tag to compare

Changelog

  • skipping directories without read permission
  • add flag -l for only listing paths that match pattern.

brename v2.4.0

17 Dec 05:53
Compare
Choose a tag to compare

Changelog

  • supporting automatically mkdir. #5

      $ brename -f .txt -p '-' -r '/'
      [INFO] checking: [ ok ] 'a-b-c.txt' -> 'a/b/c.txt'
      [INFO] 1 path(s) to be renamed
      [INFO] renamed: 'a-b-c.txt' -> 'a/b/c.txt'
      [INFO] 1 path(s) renamed
    
      $ tree a
      a
      └── b
          └── c.txt
    

brename v2.3.0

06 Aug 00:40
Compare
Choose a tag to compare

Changelog

  • add option -e/--ignore-ext for ignore file extension ( #4 ). e.g.

      $ brename -p '.+(S\d+E\d+).+' -r '$1' -d -e
      [INFO] checking: [ ok ] 'XXXXXX.S01E01.XXXX.720p.WEB-DL.AAC2.0.H.264-MC.ass' -> 'S01E01.ass'
      [INFO] checking: [ ok ] 'XXXXXX.S01E01.XXXX.720p.WEB-DL.AAC2.0.H.264-MC.mkv' -> 'S01E01.mkv'
      [INFO] 2 path(s) to be renamed
    
  • build static binaries

brename v2.2.0

05 May 14:00
Compare
Choose a tag to compare

Changelog

  • Add supporting replace with ascending integer ({nr} in value of flag -r/--replacement)

      $ brename -p '(.+)\.' -r 'pic-{nr}.' -f .jpg
      [INFO] checking: [ ok ] 'AA.jpg' -> 'pic-1.jpg'
      [INFO] checking: [ ok ] 'b.jpg' -> 'pic-2.jpg'
      [INFO] 2 path(s) to be renamed
    
  • Add supporting renaming submatch with corresponding value via key-value file (-k/--kv-file) ({kv} in value of flag -r/--replacement)

      $ more kv.tsv
      a       一
      b       二
      c       三
    
      $ brename -p '^(\w)' -r '{kv}' -k kv.tsv -K -i  -d
      [INFO] read key-value file: kv.tsv
      [INFO] 3 pairs of key-value loaded
      [INFO] checking: [ ok ] 'AA.jpg' -> '一A.jpg'
      [INFO] checking: [ ok ] 'b.jpg' -> '二.jpg'
      [WARN] checking: [ unchanged ] 'hello b.html' -> 'hello b.html'
      [WARN] checking: [ unchanged ] 'kv.tsv' -> 'kv.tsv'
    

brename v2.1.3

27 Apr 14:23
Compare
Choose a tag to compare

Changelog

  • fix log error, and bug of wrongly including dir

brename v2.1.2

26 Apr 05:35
Compare
Choose a tag to compare