Section Next | Prev


2.4.10 ディレクトリの削除(rmdir)

【機能説明】
コマンド rmdir は指定したディレクトリを削除します。 削除するディレクトリは空でなくてはいけません。
複数のディレクトリ名を指定することによって、 それらを同時に削除することができます。

【入力フォーマット】
rmdir ディレクトリ ...

【実行例】
空でないディレクトリは削除できません。
	[student@h006 ~]$ rmdir tmp
	rmdir: `tmp' を削除できません: ディレクトリは空ではありません
	[student@h006 ~]$ ls tmp
	file3  name.lis
	[student@h006 ~]$ rm tmp/*
	[student@h006 ~]$ ls tmp
	[student@h006 ~]$ rmdir tmp

カレントディレクトリの削除はできません。
	[student@h006 ~]$ rmdir .
	rmdir: `.' を削除できません: 無効な引数です

rm コマンドによっても、ディレクトリを削除することができます。
	[student@h006 ~]$ ls subdir
	a  b  c
	[student@h006 ~]$ rm -r subdir
	[student@h006 ~]$ ls subdir
	ls: subdir にアクセスできません: そのようなファイルやディレクトリはありません
補足)特別なディレクトリ
パス意味
.現在のディレクトリ
..ひとつ上のディレクトリ
~ホームディレクトリ
~XXXユーザXXXのホームディレクトリ

Section Next | Prev

Copyright 2007-2018 ycosSystems GettingStart/Body24A.html