cli remove directory code example
Example 1: how to remove folder and its contents in linux
rm -rf dirname
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: remove a file or dir in linux or mac or ubuntu
note:your_file_name can be a dir or a file
sudo rm -r your_file_name
Example 4: delete a directory bash script
rmdir dirname
Example 5: remove folder and contents linux
# Remove Single File Using rm:
rm file1.txt
# Remove Directory and it's contents:
rm -r dir1 # '-r' is short for '-recursive'
# Remove empty Directory:
rm -d dir1 # '-d' is short for '-dir'
Example 6: remove all directrories in onde command hit
rm -R -- */