
How do I remove a directory and all its contents? - Unix & Linux …
In bash all I know is that rmdir directoryname will remove the directory but only if it's empty. Is there a way to force remove subdirectories?
bash - How to delete a directory that contains other subdirectories …
Jul 16, 2023 · 3 I have a directory that contains files and other directories. I need to delete then all in one command, but without asking me for each file if I'm sure that i want to delete i; there is …
linux - find and delete file or folder older than x days - Stack …
It will also delete old files in a directory with newer files. This may result in empty directories staying 8 more days since deletion of a files updates the directory.
Delete files older than X days - Unix & Linux Stack Exchange
Apr 7, 2015 · I have found the command to delete files older than 5 days in a folder find /path/to/files* -mtime +5 -exec rm {} \\; But how do I also do this for subdirectories in that folder?
Check if directory exists and delete in one command
Jun 3, 2024 · In bash, [ -d something ] checks if there is directory called 'something', returning a success code if it exists and is a directory. Chaining commands with && runs the second …
How do you delete files older than specific date in Linux?
95 I used the below command to delete files older than a year. find /path/* -mtime +365 -exec rm -rf {} \; But now I want to delete all files whose modified time is older than 01 Jan 2014. How do …
How to remove files and directories quickly via terminal (bash shell ...
Apr 15, 2017 · When I use the rmdir command it only removes empty folders. If I have a directory nested with files and folders within folders with files and so on, is there a way to delete all the …
Shell script to delete directories older than n days
Aug 8, 2012 · I have directories named as: 2012-12-12 2012-10-12 2012-08-08 How would I delete the directories that are older than 10 days with a bash shell script?
linux - Remove a symlink to a directory - Stack Overflow
8 If rm cannot remove a symlink, perhaps you need to look at the permissions on the directory that contains the symlink. To remove directory entries, you need write permission on the …
How do I delete a directory in Centos 7 [duplicate] - linux
Nov 21, 2017 · I am using Centos as my server OS and in my desktop I have a directory called "john", I need delete it via a command. How can I do this?