V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
这是一个专门讨论 idea 的地方。

每个人的时间,资源是有限的,有的时候你或许能够想到很多 idea,但是由于现实的限制,却并不是所有的 idea 都能够成为现实。

那这个时候,不妨可以把那些 idea 分享出来,启发别人。
kily

不知道大家有没有用过正则批量替换文件名的命令或者命令行工具之类的?

  •  
  •   kily · Mar 18, 2015 · 3884 views
    This topic created in 4064 days ago, the information mentioned may be changed or developed.
    有时候有把类似 image.jpg [email protected] [email protected] 这些文件名重命名的这种需求。
    没有的话自己写个简单的好像也不麻烦。有的话就不造轮子了。
    多谢!
    7 replies    2015-03-18 19:03:38 +08:00
    hicdn
        1
    hicdn  
       Mar 18, 2015   ❤️ 1
    linux rename
    rrfeng
        2
    rrfeng  
       Mar 18, 2015
    windows ren
    kily
        3
    kily  
    OP
       Mar 18, 2015
    @hicdn 多谢!
    aliuwr
        4
    aliuwr  
       Mar 18, 2015
    Linux 上能搜索到的工具都试过了, 替换表达式不支持正则.
    于是自己用 Python 写了个.
    https://gist.github.com/2c059f9cd0bcd88eff94.git
    aliuwr
        5
    aliuwr  
       Mar 18, 2015
    imn1
        6
    imn1  
       Mar 18, 2015
    @aliuwr
    莫非你用的是archlinux?不少发行版是把perl-rename作为默认rename的,用正则没问题
    另外装 regex 代替 re 吧,py 的内部 re 有点问题的
    lgh
        7
    lgh  
       Mar 18, 2015
    不限命令行的话,Total Commander
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   971 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 46ms · UTC 23:41 · PVG 07:41 · LAX 16:41 · JFK 19:41
    ♥ Do have faith in what you're doing.