How to delete lots of directory at a one time in Linux or UNIX

www.lautt‮oc.iru‬m
How to delete lots of directory at a one time in Linux or UNIX

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.

Created Time:2017-10-28 21:39:02  Author:lautturi