Create New Document

The title of your document (will be displayed as H1)
URL-friendly name (no spaces, use dashes)
Path where to create document (optional, use forward slashes to create subdirectories)

Move/Rename Document

Current location of the document
New path for the document (including the slug)
This only changes the document's path. It does not modify the document's title (H1 heading).

Delete Document

Are you sure you want to delete this document? This action cannot be undone.

Warning: If this is a folder, all contents including subfolders and documents will be deleted.

Message

Message content goes here.

Confirm Action

Are you sure?

Attachments

Allowed file types: jpg, jpeg, png, gif, svg, webp, txt, log, csv, sfd, zip, pdf, docx, xlsx, pptx, mp4 (Max: 10MB)

Document Files

Loading attached files...

Document History

Previous Versions

Loading versions...

Preview

Select a version to preview

Wiki Settings

Language for the user interface
Number of versions to keep per document. Set to 0 to disable versioning.
Maximum allowed file size for uploads in MB.

User Management

Add New User

Leave empty to keep current password
Users with these groups can access restricted sections.

Define path-based access rules for sections of your wiki, then assign users to groups in the Users tab. Rules are evaluated in order. First match wins.

Active Rules

Import markdown files from a ZIP archive. Files will be processed and stored in the appropriate document structure. Directory structure in the ZIP (category/subcategory) will be preserved in the wiki.

Upload a ZIP file containing markdown (.md) files to import.

Create and manage backups of your wiki data. Backups include all documents, images, and configuration files.

Available Backups

Loading backups...

Add/Edit Access Rule

Selected: /

Add Column

Banner

rmdir

rmdir 命令详解

rmdir 全称:Remove Directory(删除目录)

用法:rmdir [选项]... 目录名...
删除指定的目录(前提是它们必须为空)。

      --ignore-fail-on-non-empty
                  忽略因目录非空而导致的删除失败错误
  -p, --parents   删除指定目录及其上级空目录;例如 'rmdir -p a/b/c' 
                  相当于执行 'rmdir a/b/c a/b a'
  -v, --verbose   为每个处理的目录输出详细信息
      --help      显示此帮助信息并退出
      --version   输出版本信息并退出

GNU coreutils 在线帮助:<https://www.gnu.org/software/coreutils/>
完整文档:<https://www.gnu.org/software/coreutils/rmdir>
或通过本地命令查看:info '(coreutils) rmdir invocation'

常用案例

1. 基本用法 - 删除空目录

rmdir myfolder
# 删除当前目录下名为 myfolder 的空目录

2. 删除多个空目录

rmdir dir1 dir2 dir3
# 一次删除 3 个空目录

3. 递归删除 - 逐级删除空目录(⭐ 实用)

rmdir -p a/b/c
# 相当于执行:
# rmdir a/b/c   (删除最深层)
# rmdir a/b     (删除父级)
# rmdir a       (删除祖父级)
# 注意:每一级都必须是空目录才能成功

假设你当前的路径是 /opt/nihao/nihaoa/nihaob,想删除整个 nihaob 及其上级空目录:

rmdir -p /opt/nihao/nihaoa/nihaob
# 会尝试删除:nihaob → nihaoa → nihao
# 但如果 nihao 下还有其他文件/目录,会报错并停止

4. 显示删除过程

rmdir -v empty_folder
# 输出:rmdir: removing directory, 'empty_folder'
rmdir -pv a/b/c
# 输出:
# rmdir: removing directory, 'a/b/c'
# rmdir: removing directory, 'a/b'
# rmdir: removing directory, 'a'

5. 忽略非空目录错误

rmdir --ignore-fail-on-non-empty nonempty_folder
# 如果目录非空,不报错,静默跳过
# 注意:不会强制删除非空目录,只是不显示错误信息

⚠️ 重要限制

rmdir 只能删除空目录,如果目录里有任何文件或子目录,会报错:

rmdir nonempty
# 报错:rmdir: failed to remove 'nonempty': Directory not empty

rmdir vs rm -r 对比

命令 适用场景 安全性
rmdir 删除空目录 ✅ 安全,不会误删文件
rm -r 删除目录及其所有内容(递归强制删除) ⚠️ 危险,删了找不回
rm -rf 强制递归删除(不提示) 🔴 非常危险,谨慎使用

实际使用建议

# ✅ 安全做法:先清空目录,再删除
rm -rf myfolder/*    # 删除目录下所有内容
rmdir myfolder       # 再删除空目录

# ✅ 或者直接用 rm -r(但确认无误再执行)
rm -r myfolder       # 递归删除整个目录

# 🔴 千万不要在根目录执行
rm -rf /             # 系统会崩溃!千万别试!

快速记忆表

参数 全称 含义 使用场景
-p parents 逐级删除父目录 删除完子目录后,顺手删掉空的父目录
-v verbose 显示详细信息 想看删了哪些目录时用
--ignore-fail-on-non-empty - 忽略非空错误 脚本中防止报错中断

补充小技巧

# 删除所有名为 'temp' 的空目录(配合 find)
find . -type d -name "temp" -empty -exec rmdir {} \;

# 查看当前目录下所有空目录
find . -type d -empty

# 删除空目录并显示过程
rmdir -v $(find . -type d -empty)  # 谨慎使用

记住:rmdir 只删空目录,要删有内容的目录用 rm -r,但小心使用! 😊

Attached Files

Loading attached files...
Search Results