To delete multiple directories at once in Linux or UNIX, you can use the rm
command with the -r
option and the *
wildcard.
For example, to delete all directories in the current directory that start with the string "dir", you can use the following command:
rm -r dir*
This will delete all directories in the current directory that start with "dir", including any subdirectories and files within those directories.
You can also use the find
command to delete directories that match certain criteria. For example, to delete all directories in the current directory that are older than 30 days, you can use the following command:
find . -type d -mtime +30 -delete
This will find all directories in the current directory that are older than 30 days and delete them.
It is important to use these commands with caution, as they can delete a large number of files and directories at once and cannot be undone. Make sure you understand the consequences of the command before running it.