<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          Go項目推薦:一個快速安全的批量重命名開源工具

          共 5169字,需瀏覽 11分鐘

           ·

          2021-06-24 01:00

          F2 是一個快捷鍵,進行文件重命名。今天推薦一個開源工具,它的名字就叫做 f2,是一個跨平臺、快速、安全的批量重命名工具。

          項目地址:https://github.com/ayoisaiah/f2,剛開源,使用 Go 語言實現(xiàn)的。

          它核心的特色是安全和快速。在速度方面,對比了幾個工具:

          • rnm[1] (C++) — v4.0.9
          • rnr[2] (Rust) — v0.3.0
          • brename[3] (Go) — v2.11.0

          f2 的結(jié)論是它比以上工具都快 2~3 倍。

          具體其他特色有:

          • 跨平臺,支持 Linux、MacOS 和 Windows;
          • 支持正則表達式過濾文件,并支持分組;
          • 安全,體現(xiàn)在默認執(zhí)行改名操作,而是預(yù)覽,只有告訴它改名它才執(zhí)行;
          • 支持遞歸重命名;
          • 支持撤回;
          • 。。。

          安裝該工具,可以通過 go get 安裝,也可以通過 npm 安裝,因為發(fā)布到了 npm 上:

          $ npm i @ayoisaiah/f2 -g

          以下是 f2 的命名幫助文檔:

          DESCRIPTION:
            F2 is a command-line tool for batch renaming multiple files and directories quickly and safely

          USAGE:
             f2 FLAGS [OPTIONS] [PATHS...]

          AUTHOR:
             Ayooluwa Isaiah <[email protected]>

          VERSION:
             v1.1.0

          FLAGS:
             --find string, -f string       Search string or regular expression.
             --replace string, -r string    Replacement string. If omitted, defaults to an empty string.
             --start-num value, -n value    Starting number when using numbering scheme in replacement string such as %03d (default: 1)
             --output-file value, -o value  Output a map file for the current operation
             --exec, -x                     Execute the batch renaming operation (default: false)
             --recursive, -R                Rename files recursively (default: false)
             --undo value, -u value         Undo a successful operation using a previously created map file
             --ignore-case, -i              Ignore case (default: false)
             --ignore-ext, -e               Ignore extension (default: false)
             --include-dir, -d              Include directories (default: false)
             --only-dir, -D                 Rename only directories (implies include-dir) (default: false)
             --hidden, -H                   Include hidden files and directories (default: false)
             --fix-conflicts, -F            Fix any detected conflicts with auto indexing (default: false)
             --help, -h                     show help (default: false)
             --version, -v                  print the version (default: false)

          WEBSITE:
            https://github.com/ayoisaiah/f2

          看一個具體簡單的例子:

          $ f2 -f 'Screenshot' -r 'Image'
          +--------------------+---------------+--------+
          |       INPUT        |    OUTPUT     | STATUS |
          +--------------------+---------------+--------+
          | Screenshot (1).png | Image (1).png | ok     |
          | Screenshot (2).png | Image (2).png | ok     |
          | Screenshot (3).png | Image (3).png | ok     |
          +--------------------+---------------+--------+

          當不提供 -x Flag 時,只是展示改名后的樣子,只有加上了 -x,才會真正的執(zhí)行改名操作。

          在項目主頁提供了其他例子供參考。

          此外,如果你是一個 Go 愛好者,可以學(xué)習下它的源碼,它使用了 github.com/urfave/cli 這個庫,我也是很喜歡這個庫。學(xué)習開源項目源碼,對自己能力會很有幫助。

          參考資料

          [1]

          rnm: https://github.com/neurobin/rnm

          [2]

          rnr: https://github.com/ChuckDaniels87/rnr

          [3]

          brename: https://github.com/shenwei356/brename


          文末「閱讀原文」可直達項目首頁。


          今天的項目大家覺得怎么樣嗎?如果你喜歡,請在文章底部留言、點贊或關(guān)注轉(zhuǎn)發(fā),你的支持就是我持續(xù)更新的最大動力!



          推薦閱讀


          福利

          我為大家整理了一份從入門到進階的Go學(xué)習資料禮包,包含學(xué)習建議:入門看什么,進階看什么。關(guān)注公眾號 「polarisxu」,回復(fù) ebook 獲取;還可以回復(fù)「進群」,和數(shù)萬 Gopher 交流學(xué)習。

          瀏覽 88
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  精品逼逼| 黄色小视频免费观看 | 操逼达人 | 2021国产免费自拍视频 | 毛片艹逼午夜 |