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 :: install go lang on wsl 
Shell :: terminal how to find a directory 
Shell :: docker build no cache layer dockerfile --no-cache "docker-compose" context 
Shell :: shell write multiple lines to file 
Shell :: linux tail a file 
Shell :: how add access user to docker linux 
Shell :: remove nvm version 
Shell :: list all the files changed in PR 
Shell :: flutter doctor android license exception in thread main 
Shell :: sudo /opt/lampp/lampp start not working on linux 
Shell :: install torch2trt nvidia jetson 
Shell :: create necxt app 
Shell :: WSL2 trying to launch VSCode with code . results in error "Please install missing certificates." 
Shell :: how to install pyqt5 dev tools 
Shell :: ubuntu watch log file command 
Shell :: linux permission denied jupyter notebook 
Shell :: windows tail command powershell 
Shell :: insufficient permission for adding an object to repository database .git/objects 
Shell :: rostopic echo filter 
Shell :: zsh mac 
Shell :: install tar.xz on ubuntu 
Shell :: git source autocomplete 
Shell :: linux remove empty lines 
Shell :: How to completely remove Mod Pagespeed from Ubuntu 
Shell :: cisco save running config 
Shell :: discord components python install 
Shell :: how to access docker container bash 
Shell :: linux create folder with date 
Shell :: linux screen 
Shell :: open local files wsl 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =