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

 -->

refs



©xgqfrms 2012-2025

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

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


posted @   xgqfrms  阅读(290)  评论(1编辑  收藏  举报
相关博文:
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
历史上的今天:
2022-03-09 js regexp remove all non-alphanumeric characters All In One
2022-03-09 微软 RD All In One
2021-03-09 Object Deep Copy All In One
2021-03-09 element-ui 的 table 数据 id 重复,如何渲染重复的 id 行 和 单选 radio checkbox 解决方案
2021-03-09 js array remove item All In One
2021-03-09 广告系统-开发文档 All In One
2020-03-09 HTML5 export excel All In One
点击右上角即可分享
微信分享提示