xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

使用 Linux 命令行对文件系统进行批量操作 All In One

使用 Linux 命令行对文件系统进行批量操作 All In One

Q: 如何快速的创建一些有规律递增的文件夹

  1. vscode 右键菜单,一个一个的创建
    💩 浪费生命,浪费时间,效率低

image

  1. 先使用 vscode emmet & html 先手动构造出所有的文件名列表;然后再复制粘贴成 Linux命令创建
    👎 麻烦,繁琐,需要前置条件
div*12{file-0$}
Emmet Abbreviation

<div>file-01</div>
<div>file-02</div>
<div>file-03</div>
<div>file-04</div>
<div>file-05</div>
<div>file-06</div>
<div>file-07</div>
<div>file-08</div>
<div>file-09</div>
<div>file-010</div>
<div>file-011</div>
<div>file-012</div>
file-01 file-02 file-03 file-04 file-05 file-06 file-07 file-08 file-09 file-010 file-011 file-012

# chapter-01, chapter-02, ..., chapter-12
$ mkdir chapter-01 chapter-02 ... chapter-12

image

image

image

  1. 使用 Linux 命令行批量创建

文件夹

  1. 使用 Linux 命令行批量创建文件夹、批量删除文件夹
# 批量创建文件夹 ✅
$ mkdir chapter-{01..12}

# 批量删除文件夹
$ rmdir chapter-{01..12}

$ rm -rf */

文件

  1. 使用 Linux 命令行批量创建文件、批量删除文件
# 批量创建文件
$ touch file-01.md file-02.md ... file-12.md
# 🚀
# $ touch file-0{1..12}.md
# fix: 012 bug ✅
$ touch file-{01..12}.md

# 批量删除文件
$ rm -rf file-{01..12}.md
$ rm -rf *.md

文件夹 + 文件 ???

$ touch chapter-01/index.html chapter-02/index.html
# ❌ No such file or directory
<!--

cd ../ && rm -rf ./test/*.md

mkdir test && cd ./test

 -->

(🐞 反爬虫测试!打击盗版⚠️)如果你看到这个信息, 说明这是一篇剽窃的文章,请访问 https://www.cnblogs.com/xgqfrms/ 查看原创文章!

refs



©xgqfrms 2012-2021

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2023-03-09 18:34  xgqfrms  阅读(274)  评论(1编辑  收藏  举报