LoginSignup
0
0

More than 1 year has passed since last update.

rmdir: failed to remove "xxxx": Directory not emptyエラーが出た場合:正しいコマンドはrm -r !

Posted at

中身が空ではないディレクトリを消す場合

  • ファイルが存在するディレクトリを削除する場合、以下のコマンドを実行します。
$ rm -r sample

間違えて以下のようなコマンドを打つと失敗します

  • 以下はディレクトリ削除コマンドではありません
$ rm sample
rm: cannot remove 'sample': Is a directory
  • 以下は中身にファイルがない場合のコマンドです
$ rmdir sample
rmdir: failed to remove 'sample': Directory not empty
  • ちなみに「-rf」オプションを付けると、本当に消していいのか?という警告なしで削除できます
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0