Linux/macOS
Windows
> cd temp
> ls
Directory: C:\Users\zed\temp
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 12/17/2011 9:03 AM stuff
> cd stuff/things/orange/apple/pear/grape/
> cd ..
> rmdir grape
> cd ..
> cd ..
> rmdir apple
> cd ..
> rmdir orange
> cd ..
> ls
Directory: C:\Users\zed\temp\stuff
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 12/17/2011 9:14 AM things
> rmdir things
> cd ..
> ls
Directory: C:\Users\zed\temp
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 12/17/2011 9:14 AM stuff
> rmdir stuff
> pwd
Path
----
C:\Users\zed\temp
> cd ..
>
- 创建 20 个目录,然后移除它们。
- 创建一个 10 层路径的目录,然后一次移除一个,就像我之前做的那样。
- 如果你试着移除一个有内容的目录,你会收到报错。我会在后面的练习中教你如何移除它们。