CMD文件、文件夾操作

創建刪除文件夾

mkdir/md功能是一樣的,可以查看文檔
rmdir/rd

F:\> mkdir /?
F:\> md /?
# 可以看出說明文檔是一致的
F:\> mkdir a b c d # 會在當前目錄下創建a、b、c、d四個文件夾
F:\> tree # 顯示當前目錄,以樹形結構顯示
F:.
├───a
├───b
├───c
└───d
F:\> rmdir a b c d # 刪除a、b、c、d文件夾
F:\> mkdir e\f\g\h # 會在當前目錄下創建e\f\g\h
F:\> tree 
F:.
└───e
    └───f
        └───g
            └───h
F:\> rmdir e\f\g\h # 只能刪除最後一層空目錄
F:\> tree
F:.
└───e
    └───f
        └───g

F:\> rmdir /S e # 刪除目錄e及其包含的所有文件
F:\> rmdir /? # rmdir 有兩個參數
/S      Removes all directories and files in the specified directory
        in addition to the directory itself.  Used to remove a directory
        tree.

/Q      Quiet mode, do not ask if ok to remove a directory tree with /S
F:\>

創建刪除文件

F:\> touch nul > test.txt
# nul表示空設備,從概念上講,它不可見,存在於每個目錄中,可以把它看成一個特殊的“文件”,它沒有內容
F:\> del test.txt 刪除指定文件
F:\> del *.txt 刪除所有txt文件
發佈了35 篇原創文章 · 獲贊 7 · 訪問量 3萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章