Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

how to delete a non empty directory in linux

1. To recursively delete use

$ rm -r dirname

2.To forcefully delete use

$ rm -rf dirname
Comment

delete non empty directory cmd

rm -rf directoryname
Comment

rmdir directory not empty

To remove(delete) a directory use:
rmdir *directory name* 
e.g: rmdir "my directory"

To remove a non-empty directory use:
rm -r *directory name*
e.g: rm -r "my non-empty directory"


Use "" when your directory path (absolute or relative) or name contains spaces
Comment

How to remove a non empty directory

//remove a non empty directory
rm -r dir1

//remove a directory within directory without being promopted
rm -rf dir1
Comment

Delete non empty folder

rm -Rf
Comment

Linux remove non empty directory

rm -rf dirnameCopy
Comment

rmdir directory not empty

rmdir folder1  folder2 #remove empty directory folders
rm -rf folder1 folder2 #remove non-empty folders and its content recursively
Comment

remove a non empty directory

sudo rm -R [Directory name]
Comment

remove the empty directory

# Python program to explain os.rmdir() method 
      
# importing os module 
import os 
      
# Directory name 
directory = "Geeks"
      
# Parent Directory 
parent = "D:/Pycharm projects/"
      
# Path 
path = os.path.join(parent, directory) 
      
# Remove the Directory 
# "Geeks" 
os.rmdir(path)
Comment

PREVIOUS NEXT
Code Example
Shell :: take a screenshot linux terminal 
Shell :: cat in bash shell 
Shell :: git hub nvm 
Shell :: git merging to branch from branch 
Shell :: do command in a command linux 
Shell :: angular install ngx-bootstrap 
Shell :: ls command in terminal 
Shell :: curl command parameters 
Shell :: fslmaths 
Shell :: flutter doctor --android-licenses error 
Shell :: Examples of add-apt-repository and updating the APT cache 
Shell :: install phoenix 1.6 
Shell :: how to install rpm package opensuse 
Shell :: install kali software manager support 
Shell :: linux find file type under a specific folder 
Shell :: abort current task mac terminal 
Shell :: GPG error: https://packages.sury.org/php buster InRelease: 
Shell :: active directory update Home folder path powershell 
Shell :: airodump output to file 
Shell :: linux up command multiple level of directory 
Shell :: git branch not clean 
Shell :: Install Geforce Now on Ubuntu 
Shell :: store all terminal output in a file 
Shell :: solr cloud cluster setup 
Shell :: most git libya 
Shell :: react-native app examples github 
Shell :: find drive D windows sub system linuc 
Shell :: show windows version cnd 
Shell :: install kubernetes on wsl 
Shell :: composer install repo from tar 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =