To remove an existing directory from your working directory, move to the target directory, delete all its files, move back to the parent directory, and then use the rmdir command:
cd /u/uselessThe -i switch forces rm to prompt for confirmation before removing a file. If you try to remove a directory that is not empty, you will see a warning displayed. You may use the following shorter method instead of the above:pwd
/u/useless
rm -i *
cd ..
rmdir useless
rm /u/useless/*or:rmdir /u/useless
rm -r /u/uselessThe -r switch removes all files recursively from the directory tree.
Note that these do not delete the hidden files such as .login. For that issue the command
rm /u/useless/.*