【问题标题】:Bash script help - convert bunch of .lit files to .txt files, remove spaces in file namesBash 脚本帮助 - 将一堆 .lit 文件转换为 .txt 文件,删除文件名中的空格
【发布时间】:2010-11-21 18:41:56
【问题描述】:

所以我有以下文件

Eoin Colfer - Artemis Fowl 01 - Artemis Fowl.lit
Eoin Colfer - Artemis Fowl 02 - The Arctic Incident.lit

等等。我想将每个点亮的文件放在不同的目录中,使用 Calibre 的 ebook-convert 将它们更改为 .txt 文件,去除空格的文件名。到目前为止,这就是我所拥有的。

查找电子书 -type f -iname '*.lit' -exec ebook-convert '{}' '{}'.txt

现在,如何删除文件名中的空格,以及如何删除文件名中的 .lit?

【问题讨论】:

    标签: bash scripting


    【解决方案1】:

    如果您的系统有名为 rename 的 Perl 脚本:

    rename 's/ //g;s/.lit.txt$/.txt/' *.lit.txt
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-10-28
      • 2021-01-26
      • 1970-01-01
      • 2016-05-12
      • 2014-09-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多