Post view

MS-DOS 7.0 輕鬆學 for Windows 95 - 4:多層次資料夾-3

MS-DOS 7.0 輕鬆學 for Windows 95 - 4:多層次資料夾-3

4.jpg

資料夾管理命令

MS-DOS提供了CD、MD、RD三個資料夾管理指令,前面已經介紹了CD和MD,現在讓我們再認識一次:

・CD:打開指定的資料夾,並同時改變目前的工作資料夾。CD是Change Directory改變目錄的縮寫。

・MD:製作一個新的空白資料夾,一次只能建一個新的資料夾。MD是Make Directory製作目錄的縮寫。

・RD:刪除空白的資料夾。要是資料夾含有檔案或其他小資料夾,必須先全數刪除後並回到上層資料夾才能刪掉自己。RD是Remove Directory移除目錄的縮寫。

製作資料夾

製作新資料夾的方法很簡單,讓我們再試一次。只要用MD指令並輸入資料夾名稱即可。例如:

A:\>md game Enter    ← 製作一個 GAME 資料夾

從MS-DOS提示符號,我們知道目前是在A:\ 磁碟底下,因此新的GAME資料夾會做在A:\ 磁碟機,也就是GAME是磁碟機的第一層資料夾。我們也可以用下列的指令,達到相同的目的:

A:\>md a:\game Enter   ← 指定在A:\ 底下建立 GAME 資料夾

打開資料夾

現在讓我們打開新的GAME資料夾吧。請在DOS的命令提示號輸入「cd資料夾名稱」,譬如:

A:\>md game Enter    ← 這是你剛才輸入的指令
A:\>cd game Enter    ← 緊接著請打開 game 資料夾
A:\game>_            ← 已進入 GAME 資料夾了

我們知道在GAME資料夾裡面也會有 . 和 .. 資料夾,現在讓我們一塊兒來試試底下的DIR指令:

A:\game>dir . Enter ← 請試試 dir、dir .、dir *.* 有何不同?

 Volume in drive A is BRENT SU
 Volume Serial Number is 0FE9-3230
 Directory of A:\game

.              <DIR>        01-08-97   9:58 .
..             <DIR>        01-08-97   9:58 ..
         0 file(s)              0 bytes
         2 dir(s)       1,456,640 bytes free

A:\game>_

你會發現其實輸入dir Enter 、dir . Enter 、dir *.* Enter 其實都一樣!反正dir Enter 內定就是列出整個資料夾的內容,所以指定要列出名叫一個點的資料夾或整個資料夾,都會列出目前的資料夾的內容。也就是說輸入del . Enter 就如同輸入del *.* Enter 會刪掉該資料夾所有的檔案。我們只是說說罷了,千萬別真的輸入del *.* 啊,要不然刪掉了什麼重要的檔案,可別說我沒有事先提醒你!

既然 .. 是表示上一層的資料夾,所以我們也可以用dir .. 來顯示上層資料夾的情況囉:

A:\game>dir .. Enter    ← 嗯,一同瞧瞧上層資料夾長什麼樣子?

 Volume in drive A is BRENT SU
 Volume Serial Number is 0FE9-3230
 Directory of A:\

APEX           <DIR>        01-08-97   8:30 apex
GAME           <DIR>        01-08-97   9:58 game
         0 file(s)              0 bytes
         2 dir(s)       1,456,640 bytes free

A:\game>dir \ Enter     ← 不錯不錯,讓我們再試試這個指令

 Volume in drive A is BRENT SU
 Volume Serial Number is 0FE9-3230
 Directory of A:\

APEX           <DIR>        01-08-97   8:30 apex
GAME           <DIR>        01-08-97   9:58 game
         0 file(s)              0 bytes
         2 dir(s)       1,456,640 bytes free

A:\game>_

MS-DOS用單一的 \ 倒斜線來表示磁碟機(雖然 \ 同時磁碟機與各資料夾之間的分隔線)所以當我們輸入dir \ Enter 就會列出磁碟機底下的內容。當然你也可以輸入dir a:\ Enter ,效果保證一模一樣,只是如此一來為什麼要多輸入a: 呢?直接用 \ 來代替a:\ 不是更簡單嗎?不過要從A: 磁碟dir c:\ 就不能省略磁碟機代號了。

哦對了!你必須輸入a: 而不是a; !冒號和逗號雖然有一點像又不會太像,但終究是不同的符號。

刪除資料夾

不要的資料夾可以用MS-DOS提供的RD或DELTREE指令刪除掉。RD一次只能刪掉一個「空的資料夾」,不能刪除含有任何檔案或其他小資料夾的資料夾,也不能刪除已打開的資料夾(即使該資料夾是空的)。我們必須把該資料夾清除乾淨並回到上層資料夾,才能用RD移除空白資料夾。

刪掉GAME資料夾的方法很簡單,請輸入底下的指令:

A:\game>rd game Enter    ← 哦,不不!我們不是說過不能直接刪除
                          正在使用的資料夾嗎?這個指令會變成
                          想要刪掉C:\game\game這個資料夾
Invalid path, not directory,   ← 無效的路徑,不是資料夾目錄
or directory not empty            或是資料夾不是空的!

A:\game>cd .. Enter      ← 要刪掉自己時,要記得關掉資料夾回到
                          上一層資料夾,再輸入 RD 指令
A:\>rd game Enter        ← 移除 GAME 資料夾

A:\>dir Enter            ← 好,用 DIR 指令列出來瞧瞧

 Volume in drive A is BRENT SU
 Volume Serial Number is 0FE9-3230
 Directory of A:\

APEX           <DIR>        01-08-97   8:30 apex
         0 file(s)              0 bytes
         1 dir(s)       1,457,152 bytes free

A:\>_

要是在A:\ 底下輸入rd game的時候,還是會看到這個訊息:

Invalid path, not directory,
or directory not empty

請檢查一下輸入的資料夾名稱是否正確,比方說誤打成rd geme而不是rd game。也可能是該資料夾不存在了,比方講你已經執行過rd game又再執行rd game,當然會看到錯誤訊息了。

資料夾使用實務

現在讓我們一起為Apex顧問公司製作Andy劉德華、Jacky張學友和Vivi周慧敏專屬的資料夾吧:

A:\>cd apex Enter             ← 打開 APEX 資料夾

A:\apex>md system Enter       ← 製作系統部專用的資料夾

A:\apex>md "paymaster" Enter  ← 建立會計部,使用長資料夾名稱

A:\apex>md r&d Enter          ← 製作研發部專用資料夾

A:\apex>md procure Enter      ← 製作採購部資料夾

A:\apex>md sales Enter        ← 製作業務部資料夾

A:\apex>md worker Enter       ← 製作人事部資料夾

A:\apex>md mis Enter          ← 製作電腦管理部資料夾

在Windows 95的MS-DOS模式底下,我們可以直接製作超過8個字元的資料夾。長檔名必須用一對 “” 雙引號括住。

A:\apex>cd sales Enter            ← 再打開 SALES 資料夾
A:\apex\sales>md andy Enter       ← 製作劉德華專用的資料夾
A:\apex\sales>md brent Enter      ← 製作蘇言霖的資料夾
A:\apex\sales>md jacky Enter      ← 製作張學友的資料夾
A:\apex\sales>md vivi Enter       ← 製作周慧敏的資料夾
A:\apex\sales>md winnie Enter     ← 製作黃瓊棉的資料夾
A:\apex\sales>cd\ Enter           ← 最後回到 A:\ 磁碟機底下
A:\>_

哇,好複雜!其實製作資料夾是很簡單的,事實上我們來來去去都只用CD和MD而已,應該不會這麼快就難倒你吧?OK,現在讓我們來看看你製作的資料夾:

A:\>dir apex Enter    ← 列出 APEX 資料夾的目錄

 Volume in drive A is BRENT SU
 Volume Serial Number is 0FE9-3230
 Directory of A:\apex

.              <DIR>        01-08-97   8:30 .
..             <DIR>        01-08-97   8:30 ..
SYSTEM         <DIR>        01-08-97  10:51 system
PAYMAS~1       <DIR>        01-08-97  10:53 paymaster
R&D            <DIR>        01-08-97  10:55 r&d
PROCURE        <DIR>        01-08-97  10:56 procure
SALES          <DIR>        01-08-97  11:02 sales
WORKER         <DIR>        01-08-97  10:56 worker
MIS            <DIR>        01-08-97  11:02 mis
         0 file(s)              0 bytes
         9 dir(s)       1,451,520 bytes free

A:\>_

想要調閱Apex顧問公司業務部門的資料嗎?很簡單:

A:\>dir apex\sales Enter   ← 直接列出APEX 底下的SALES資料夾

 Volume in drive A is BRENT SU
 Volume Serial Number is 0FE9-3230
 Directory of A:\apex\sales

.              <DIR>        01-08-97  11:02 .
..             <DIR>        01-08-97  11:02 ..
ANDY           <DIR>        01-08-97  11:03 andy
BRENT          <DIR>        01-08-97  11:03 brent
JACKY          <DIR>        01-08-97  11:03 jacky
VIVI           <DIR>        01-08-97  11:03 vivi
         0 file(s)              0 bytes
         6 dir(s)       1,451,520 bytes free

A:\>_

你也可以用cd apex Enter 打開Apex資料夾,再cd sales Enter 打開業務部資料夾,再用dir Enter 調閱業務部門的資料夾。但有時候以「絕對路徑」的方式直接指定要調閱的資料夾是不是更簡便呢?當然,你也可以用絕對路徑的方式來製作資料夾:

A:\>md apex Enter                 ← 製作 Apex 資料夾
A:\>md apex\system Enter          ← 系統部資料夾
A:\>md "apex\paymaster" Enter     ← 會計部資料夾
A:\>md apex\r&d Enter             ← 研發部資料夾
A:\>md apex\procure Enter         ← 採購部資料夾
A:\>md apex\sales Enter           ← 業務部資料夾
A:\>md apex\worker Enter          ← 人事部資料夾
A:\>md apex\mis Enter             ← 電腦部資料夾
A:\>md apex\sales\andy Enter      ← 劉德華資料夾
A:\>md apex\sales\brent Enter     ← 蘇言霖資料夾
A:\>md apex\sales\jacky Enter     ← 張學友資料夾
A:\>md apex\sales\vivi Enter      ← 周慧敏資料夾
A:\>md apex\sales\winnie Enter    ← 黃瓊棉資料夾
A:\>_

哇,好長一串的指令!要是你把CD和MD弄得“霧薩薩”有看沒有懂,也可以直接用MD指令來完成前面的工作,但是這樣真的更容易了解嗎?不會吧?

蘇言霖 2013/09/24 0 1132
Comments
Order by: 
Per page:
 
  • There are no comments yet
Rate
0 votes
Post info
蘇言霖
「超級懶貓級」社群網站站長
2013/09/24 (3860 days ago)
Actions