ubuntu remove folder and all contents code example

Example 1: ubuntu delete directory and all files

rm -rf ./test

Example 2: how to remove directory in cmd

# for removing empty directory
$ rmdir myDirectory

# to remove a directory that contains files and subdirectory
$ rm -r myDirectory
rm -rf /config/filegroups/*/

Example 3: ubuntu delete contents of folder

To remove all non-hidden files and sub-directories (along with all of their contents) in a 
directory use:
rm -r /path/to/directory/*

Tags:

Misc Example