Command to remove a empty and non-empty directory:
rm directory
or
rmdir directory
both will deletes the 'directory' if it is an empty directory
and
if it is not a empty directory then these commands will return an error message
for rm command:
rm: cannot remove ‘directory’: Is a directory
for rmdir command:
rmdir: failed to remove ‘directory’: Directory not empty
Solution is with rmdir we can not delete the non-empty directory
by using rm command with argument
rm -rf directory
Here,
-r, -R, --recursive
remove directories and their contents recursively
-f, --force
ignore nonexistent files and arguments, never
prompt
rm directory
or
rmdir directory
both will deletes the 'directory' if it is an empty directory
and
if it is not a empty directory then these commands will return an error message
for rm command:
rm: cannot remove ‘directory’: Is a directory
for rmdir command:
rmdir: failed to remove ‘directory’: Directory not empty
Solution is with rmdir we can not delete the non-empty directory
by using rm command with argument
rm -rf directory
Here,
-r, -R, --recursive
remove directories and their contents recursively
-f, --force
ignore nonexistent files and arguments, never
prompt
No comments:
Post a Comment