
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 …
Aug 31, 2014 · 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 …
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 …
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
Jan 30, 2011 · 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 …
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?
How to get over "device or resource busy"? - Unix & Linux Stack …
The tool you want is lsof, which stands for list open files. It has a lot of options, so check the man page, but if you want to see all open files under a directory: lsof +D /path That will recurse …
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 …
How do I delete a local repository in Git? - Stack Overflow
Oct 3, 2009 · Delete the .git directory in the root-directory of your repository if you only want to delete the git-related information (branches, versions). If you want to delete everything (git …
How to delete a directory and its contents in (POSIX) C?
See man 2 unlink and man 2 rmdir for system calls that will delete files and (empty) directories respectively. All you need to do then in order to handle the recursive case is to traverse the …